I have a bunch of Rules and some things require a bit more complex logic than usual. What I want to do is use a hook that runs when a particular rule fires, access the data that's passed in to it and manipulate it accordingly so when the rule executes it does it with the manipulated data. I looked through the Rules API and tried some of the function but none seem to have what I want. Is there such a function, or this there a better way?

A simple example: For a rule that sends an email, I want to hook in to it, check some stuff with code and then change the email address it sends to.

  • "check some stuff with code": please edit your question to provide more details about what check you want to do, and also about that "code" you have in mind. Depending on what it turns out to be, I bet you either wouldn't need such code (since you can do it with regular Rules "stuff"), or otherwise you should simply not use Rules at all for what you're trying to achieve. I know, "the customer is always right, and even if the custmer is wrong, the customer is still right" (= who am I to question this), but you should really think twice, even 5 times, before going this route ... Commented Sep 13, 2017 at 9:43

2 Answers 2


I think there are no hooks in rules by which you can achieve it. So you have 2 possible solutions. 1) In rules use the php code for action (Not recommended for security) 2) Use custom module to perform the action rather than using rules.


Instead of using built in actions you can write your own action. Custom Actions here you can find a good tutorial.

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.