FAQ

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.

This is a wiki page, so feel free to edit and improve it.

Table of Contents:

Q: I've installed the latest token module, but my tokens are still not replaced. What's wrong?
A: Don't use the actions provided by the token actions module - they don't work with rules and aren't available for use anymore in the latest module. So you can disable the token actions module when you use rules. Rules provides better integrated actions of the same kind anyway.
A2: You may also be trying to use a Token that has not been exposed. If there is no data in a token, it is not replaced. Just because a token is listed in the Token replacement patterns list, does not mean it has a value.

Q: How do I add a url of the node in my email?
A: You have to construct the url with the available tokens. For example: [node:site-url]/node/[node:nid]
A2: Use [node:node-url] (D6 + Rules 6.x-1.4 + Token 6.x-1.15)

Q: The node id (nid) of some content is missing!
The node id of some content is only available if the content has already been saved. So if you use the event 'Content is going to be saved' it's not yet available. You can use the event 'After saving new content' or 'After updating existing content'.

Q: My rules don't do what I expect. What should I do now?
Try enabling the rules debug log in the rules settings. Then rules provides the rule evaluation log once any rule is executed. This should help you to identify the problem.

Q: Where is the best place to read more about the Rules API?
http://drupal.org/node/298486

Q: Where can I find some more example/sample rules that I can import to help get me started?
The Rules handbook page

Q: Is there an "Execute PHP code" action or such?
Yes! Just activate the 'PHP filter' module (coming with drupal itself) and you'll have an "Execute PHP code" action as well as an "Execute PHP code" condition and an PHP input filter, which can be used everywhere just like tokens.

Q: Show me a basic template for a custom module condition
Add the following to your MYMOD.rules.inc file.

<?php
//
// Implementation of hook_rules_condition_info().
//
function MYMOD_rules_condition_info() {
  return array(
   
'MYMOD_rules_condition_MYCOND' => array(
     
'label' => t('MYCOND description'),
     
'arguments' => array(
       
'user' => array(
         
'type' => 'user',
         
'label' => t('MYUSER description'),
        ),
       
'node' => array(
         
'type' => 'node',
         
'label' => t('MYNODE description'),
        ),
      ),
     
'help' => t('MYHELP'),
     
'module' => 'MYMOD',
    ),
  );
}

//
// Condition: MYCOND description
//
function MYMOD_rules_condition_MYCOND($user, $node, $settings) {
 
// CUSTOM CODE
 
$res = 0;
  return (
$res == 1); // return BOOLEAN
}
?>

Q: Show me a basic template for a custom module action
Add the following to your MYMOD.rules.inc file.

<?php
//
// Implementation of hook_rules_action_info().
//
function MYMOD_rules_action_info() {
  return array(
   
'MYMOD_rules_action_MYACT' => array(
     
'label' => t('MYACT description'),
     
'arguments' => array(
       
'user' => array(
         
'type' => 'user',
         
'label' => t('MYUSER description'),
        ),
       
'node' => array(
         
'type' => 'node',
         
'label' => t('MYNODE description'),
        ),
      ),
     
'help' => t("MYHELP"),
     
'module' => 'MYMOD',
    ),
  );
}

//
// Action: MYACT description
//
function MYMOD_rules_action_MYACT($user, $node, $settings) {
 
// CUSTOM CODE
}
?>
Read more
Subscribe with RSS Syndicate content

FAQ

Group organizers

Group categories

Categories

Group notifications

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