I have a rule that when content is going to be viewed it looks to make sure that the content author does not have a particular role and the content that is going to be viewed is of the role type. That part works fine. What doesn't work is if I assign multiple actions to be triggered. What I want to do is unpublish the node, give the user who is viewing the content a nice friendly message, and redirect to my index page. It will only the redirect action while the other two are ignored.
I've tried it both with weight assigned to each action and weight = 0 and both produce the same results.
Comments
Comment #1
fagoProbably the redirect action is executed first - however with weights this shouldn't occur.
Ah but yes, the problem is that rules would save the node for you, but it can't do as the redirect happens first... That's odd - I've to take a look at it. Perhaps we can manage to move the redirect to a later place, right before the html is output.
Comment #2
mitchell commentedchanging title.
Comment #3
Charlie Sibbach commentedFunny, I just fought with Rules trying to do EXACTLY the same thing this morning. I can confirm, redirect + unpublish does not work- you can get one or the other but not both.
Comment #4
fagoOh, it does honour the weight, the problem is rules' intelligent saving mechanism, which would save the node when the rules execution ends. However before that the page redirect happens... I have to try again to find a way to postpone the page redirect using a shutdown function or maybe hook_exit.
Comment #5
fagothis should be fixed before 1.0
Comment #6
fagook, I fixed it. Now it can postpone the redirect without relying on another redirect - it issues the redirect right before the page is output. Postponing the redirect is the default now.
@lonehorseend: Just updated to the next dev snapshot and make sure you don't have the "immediate" option checked.