I have a custom Trigger that is set to execute when a particular type of content is created. The content may be created by anonymous users, so I want them to be redirected to a thank you for your submission page instead of the content itself. The reason being that the content should not be visible by anonymous users. Additionally, I want an email to be sent to an administrator when the content is created.
I have been beating my head trying to figure out why the email was never being sent until I noticed on line 97 of includes/actions.inc this comment: "// Fire actions, in no particular order." The issue that I was facing is that the redirect action was created first and therefore had a lower aid than the email action. Unfortunately, the actions are executed in "no particular order" which seems to usually be in aid order as that is what the database call returns.
Could core be modified to execute the actions in the order that they are passed to actions_do in the action_ids array? The attached patch does this just fine and doesn't change any other behavior
| Comment | File | Size | Author |
|---|---|---|---|
| actions-in-order.patch | 651 bytes | douglasmiller |
Comments
Comment #1
neRok commentedFurther up actions_do() is the following code
After this, $conditions is used as db query and added to $actions. Then the actions in $actions fire.
The problem I see with your patch is that you presume that each $action_ids is-set within $actions. Based on the two if statements above though, it is possible that an action could not be found for the action_id, and was not added to $actions. I think the patch needs a tweak to accommodate this.