Hi,
I set up a couple triggered rules. The actions are not being performed and I don't see any evidence at /admin/reports/dblog that anything is working. Will there be log entries if actions are triggered?
I'm pasting the export of one of my rules below. What I want to happen: when a user publishes a post where content type is "housing_listings" and my CCK radio button field ("field_wanted_or_offering") is set to a particular value, the code should execute. Because I can't be sure the php mail function in my code is going to work (for reasons that may have nothing to do with drupal), I also added a re-direct action so it will be obvious if the rule is working. At minimum, shouldn't I see a log entry? Thanks.
-Ryan
array (
'rules' =>
array (
'rules_9' =>
array (
'#type' => 'rule',
'#set' => 'event_node_insert',
'#label' => 'Housing Trigger -- Wanted',
'#active' => 1,
'#weight' => '0',
'#status' => 'custom',
'#conditions' =>
array (
0 =>
array (
'#weight' => 0,
'#info' =>
array (
'label' => 'Created content is published',
'arguments' =>
array (
'node' =>
array (
'type' => 'node',
'label' => 'Content',
),
),
'module' => 'Node',
),
'#name' => 'rules_condition_content_is_published',
'#settings' =>
array (
'#argument map' =>
array (
'node' => 'node',
),
),
'#type' => 'condition',
),
1 =>
array (
'#type' => 'condition',
'#settings' =>
array (
'type' =>
array (
'housing_listings' => 'housing_listings',
),
'#argument map' =>
array (
'node' => 'node',
),
),
'#name' => 'rules_condition_content_is_type',
'#info' =>
array (
'label' => 'Created content is Housing Listings',
'arguments' =>
array (
'node' =>
array (
'type' => 'node',
'label' => 'Content',
),
),
'module' => 'Node',
),
'#weight' => 0,
),
2 =>
array (
'#info' =>
array (
'label' => ' \'field_wanted_or_offering\' == wanted',
'label callback' => false,
'arguments' =>
array (
'node' =>
array (
'type' => 'node',
'label' => 'Content',
),
),
'eval input' =>
array (
0 => 'code',
1 => 'value|0|value',
),
'module' => 'CCK',
),
'#name' => 'content_rules_field_has_value',
'#settings' =>
array (
'field_name' => 'field_wanted_or_offering',
'#argument map' =>
array (
'node' => 'node',
),
'value' =>
array (
0 =>
array (
'value' => '1',
),
),
'code' => '',
'vars' =>
array (
),
),
'#type' => 'condition',
'#weight' => 0,
),
),
'#actions' =>
array (
0 =>
array (
'#weight' => 0,
'#info' =>
array (
'label' => 'Execute custom PHP code',
'module' => 'PHP',
'eval input' =>
array (
0 => 'code',
),
),
'#name' => 'rules_action_custom_php',
'#settings' =>
array (
'code' => '<?php
$msg = \'<p>Hi \'.$user->name.\',</p>\';
$msg .= \'<p>Your housing content has been published: <a href="node/\'. $node->nid . \'">\' . $node->title . \'</a></p>\';
$msg .= \'Thanks!\';
mail($user->mail, \'Your housing post has been published\', $msg);
?>',
'vars' =>
array (
0 => 'node',
1 => 'user',
),
'#eval input' =>
array (
'rules_input_evaluator_php' =>
array (
'code' =>
array (
0 => 'node',
1 => 'user',
),
),
),
),
'#type' => 'action',
),
1 =>
array (
'#weight' => 0,
'#info' =>
array (
'label' => 'Page redirect',
'module' => 'System',
'eval input' =>
array (
0 => 'path',
1 => 'query',
2 => 'fragment',
),
),
'#name' => 'rules_action_drupal_goto',
'#settings' =>
array (
'path' => 'http://www.test.org',
'query' => '',
'fragment' => '',
'force' => 1,
'override' => 0,
),
'#type' => 'action',
),
),
),
),
)
Comments
there won't be a log entry,
there won't be a log entry, if you don't use the watchdog action to write one ;) Best go to the rules settings and activate the debug log and see what happens.
I turned on debugging in the
I turned on debugging in the rules module settings and published an article meeting all the conditions... where will the debugging information be shown? I don't see it anywhere.
For testing purposes, I went ahead and eliminated all my actions for this rule and then I set an action for "log to watchdog." I then tried various things to trigger the action... I published a node meeting the conditions, then unpublished, then published, then saved while already published. Nothing triggered a rules-related log entry at /admin/reports/dblog. Of course, there are the normal entries there that are triggered by Drupal when a node is saved, but nothing with the message I set in the rules module.
What should I try next? The export for my updated rule is posted below... that is, with the watchdog action only.
-Ryan
array ('rules' =>
array (
'rules_9' =>
array (
'#type' => 'rule',
'#set' => 'event_node_insert',
'#label' => 'Housing Trigger -- Wanted',
'#active' => 1,
'#weight' => '0',
'#status' => 'custom',
'#conditions' =>
array (
0 =>
array (
'#type' => 'condition',
'#settings' =>
array (
'#argument map' =>
array (
'node' => 'node',
),
),
'#name' => 'rules_condition_content_is_published',
'#info' =>
array (
'label' => 'Created content is published',
'arguments' =>
array (
'node' =>
array (
'type' => 'node',
'label' => 'Content',
),
),
'module' => 'Node',
),
'#weight' => 0,
),
1 =>
array (
'#weight' => 0,
'#info' =>
array (
'label' => 'Created content is Housing Listings',
'arguments' =>
array (
'node' =>
array (
'type' => 'node',
'label' => 'Content',
),
),
'module' => 'Node',
),
'#name' => 'rules_condition_content_is_type',
'#settings' =>
array (
'type' =>
array (
'housing_listings' => 'housing_listings',
),
'#argument map' =>
array (
'node' => 'node',
),
),
'#type' => 'condition',
),
2 =>
array (
'#weight' => 0,
'#type' => 'condition',
'#settings' =>
array (
'field_name' => 'field_wanted_or_offering',
'#argument map' =>
array (
'node' => 'node',
),
'value' =>
array (
0 =>
array (
'value' => '1',
),
),
'code' => '',
'vars' =>
array (
),
),
'#name' => 'content_rules_field_has_value',
'#info' =>
array (
'label' => ' \'field_wanted_or_offering\' == wanted',
'label callback' => false,
'arguments' =>
array (
'node' =>
array (
'type' => 'node',
'label' => 'Content',
),
),
'eval input' =>
array (
0 => 'code',
1 => 'value|0|value',
),
'module' => 'CCK',
),
),
),
'#actions' =>
array (
1 =>
array (
'#type' => 'action',
'#settings' =>
array (
'severity' => '5',
'type' => 'rules',
'message' => 'housing wanted rule was triggered.',
'link' => '',
),
'#name' => 'rules_action_watchdog',
'#info' =>
array (
'label' => 'Log to watchdog',
'module' => 'System',
'eval input' =>
array (
0 => 'type',
1 => 'message',
2 => 'link',
),
),
'#weight' => 0,
),
),
),
),
)
where will the debugging
It's shown as a regular drupal message, so usually you can't miss it. When there is no log, this means there is no rule triggered at all. Try re-saving the rule by editing it and look for any errors.
I edited it and re-saved. I
I edited it and re-saved. I see no errors anywhere. I've seen no debugging info at any point. The module just isn't working. I'm using Drupal 6.7... and you have the rule export.
-Ryan
The rule export doesn't help
The rule export doesn't help me - as your installation isn't working right. Try uninstalling + reinstalling the module.. Something is wrong with your installation.
Guys, let's move support to
Guys, let's move support to the issue queue...
indeed
let's move to http://drupal.org/node/375152
I had suggest to use this group for support, which I think now was I bad idea. I changed that to suggesting "usage questions" for this group.
I disabled and deleted the
I disabled and deleted the module. Then uploaded again and enabled. Tested again. No entry was logged at /admin/reports/dblog
I'll post a bug report.
-Ryan
Documentation
When you go to the documentation page, http://drupal.org/node/298476, there is only one brief page with no really useful information. Is there anything more?
Thanks.
Victor