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

fago’s picture

Title: Mutiple actions for a rule not triggered even when weight is assigned » redirect action might result in not saving changes
Version: 6.x-1.0-beta3 » 6.x-1.x-dev
Component: Rules Core » Rules Engine

Probably 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.

mitchell’s picture

Title: redirect action might result in not saving changes » Redirect action not honoring weights feature

changing title.

Charlie Sibbach’s picture

Funny, 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.

fago’s picture

Title: Redirect action not honoring weights feature » Redirect action interfers with intelligent saving

Oh, 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.

fago’s picture

Issue tags: +rules 1.0

this should be fixed before 1.0

fago’s picture

Status: Active » Fixed

ok, 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.

Status: Fixed » Closed (fixed)
Issue tags: -rules 1.0

Automatically closed -- issue fixed for 2 weeks with no activity.