How to programmatically test if a rule has ran.

Events happening in the community are now at Drupal community events on www.drupal.org.
drecute's picture

I have set up a rule that triggers when a new content of a certain type is created. How is it possible to programmatically test if this rule has ran?

I have the following code

<?php
function nupostmark_test() {
   
$node = node_load($node);
   
$ntypes = node_get_types('types', $node);
   
$nodesaverule = rule_function_to_call_here;
    if(
$nodesaverule !== NULL && $ntypes == 'plistings'){
               
drupal_set_message('you can set the variable now');
               
//set some variable to make available to template.php in phptemplate_preprocess_block
           
}
}
?>

Comments

Rule settings

itangalo's picture

I would to the following things:

  1. Activate the debug messages for Rules. (See the Rules settings page.)
  2. Add an action either to display a message on the site, or to write a message to the log.

The debug information is invaluable if you have problems executing rules correctly.

//Johan Falk, NodeOne, Sweden

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: