1

I have a rule set up that uses the following action:

After updating existing content of type

It's working fine when a node is updated, but I just discovered that this rule also fires when nodes of the specified type are deleted. This makes sense, since changing the status of a node is technically an update, but this is not the desired effect as emails should not be sent when the node is deleted.

I added a small chunk of PHP inside the email generated by the rule to see what the value of $node->status is in this rule, but it is still 1, not 0 as I expected.

How can I use the 'After updating existing content of type' event, but not have it react when a node of that type is deleted?

1

Have you tried adding a rules condition for the published status of the updated node? That should stop the rule from firing.

1

I dont think it will react on node deletion also, as I had tested it.

'After updating existing content of type' event it will use hook_node_presave(), so it will never trigger hook_node_delete()

Have a look on any other Rules overriding that.

  • Taking about "testing it": me too (so I agree)! Have a look at this answer for an extremely basic rule I created for my testing ... PS: sorry I cannot +1 your answer anymore ... (I already did). – Pierre.Vriens Feb 3 '17 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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