I have two rules -

  1. Triggers - after new content is saved
  2. Triggers - after updating existing content

Problem

  • When I create a new node both rules are getting triggered together.

Probable Cause

However, there must be some solution to this. Please any suggestions, workarounds, solutions...anybody?

Thanks.

up vote 5 down vote accepted

You could add a condition in both rules to check whether the $node->created and $node->changed timestamps are same.

For a newly created node $node->created and $node->changed time will be same, while for an updated node both will be having different timestamps.

You probably need to add an Execute custom PHP code in rule condition to do this.

  • You can also use $node->new flag also... – Dinesh Kumar Sarangapani Jan 24 '13 at 5:35
  • Checking with $node->created and $node->changed worked smooth..awesome!...@DineshKumar a description in tokens under rules says - $node->is_new : 'Whether the node is new and not saved to the database yet.', I suppose its not what I want here. But thanks anyway for trying to help. – SGhosh Jan 24 '13 at 6:15

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.