Skip to content

Instantly share code, notes, and snippets.

@fago
Created February 24, 2010 10:42
Show Gist options
  • Save fago/313323 to your computer and use it in GitHub Desktop.
Save fago/313323 to your computer and use it in GitHub Desktop.
reaction rule example
$rule = rules_reaction_rule();
$rule->event('node_insert');
$rule->condition('data_is', array('data:select' => 'node:type', 'op' => 'IN', 'value' => array('product')));
$rule->condition(rules_or()
->condition('data_is', array('data:select' => 'node:product:0:type', 'value' => 'shirt'))
->condition('data_is', array('data:select' => 'node:product:author:uid', 'value' => 1))
);
$rule->action('data_set', array('data' => 'node:status', 'value' => 1));
$rule->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment