2

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.

1 Answer 1

5

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.

2
  • You can also use $node->new flag also... Commented Jan 24, 2013 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
    Commented Jan 24, 2013 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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