1

I define two rules that should send an email once new node has been created. And second rule once user updated his content.

The problem I am having here is that both rules trigger in one time when your create a new node.

I found the same issue has been asked in anther question but not very clear and i am not able to understand enter link description here

But I am not able to understand.

Thanks for the help.

1 Answer 1

2

This is very easy to accomplish, you have a few attributes of the node to compare and check in order to decide which trigger to be true/false.

Method 1: Put the following PHP code into your both conditions (create & update) by selecting execute PHP code

CREATE

if($node->created == $node->changed) { 
   return true; 
} else { 
   return false; 
}

UPDATE

if($node->created != $node->changed) {
    return true; 
} else { 
   return false; 
} 

Method 2:

UPDATE:

if($node->is_new) {
     return false; 
} else {
     return true; 
}

OR

if(!empty($node->nid)) {
    return true; 
} else {
    return false; 
}

I have not checked the Method 2 but, method 1 is easier and should definitely work out for you.

Don't forget to Accept this answer solve your problem.

Cheers.

Raf.

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.