Closed (fixed)
Project:
Rules
Version:
6.x-1.1
Component:
Rules Engine
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2010 at 05:45 UTC
Updated:
8 Dec 2011 at 08:10 UTC
hey there,
I'm producing a video gallery website. the main functionality is that the user can only see videos in the gallery on the home page, not individual ones.
I tried to create a simple rule for anonymous users, when accessing content of type Video, to be redirected to the home page, where the gallery is. but it didn't work.
my rule consists of the following parts:
1) event: content is going to be viewed
2) content is type: Video
3) page redirect: <front>
simple as that, but no joy. any ideas are appreciated.
thanks in advance,
Luciano
Comments
Comment #1
jstushnoff commentedI WAS doing pretty much exactly the same thing successfully up until a few days ago when I upgraded from Core 6.12 to 6.15 and from Rules 6.x-1.0 to 6.x-1.1
Now I just get a blank page (white screen) no matter what I try including disabling/clearing all cacheing.
Can anyone else get the page redirect action to work with the latest versions of core and rules?
EDIT: I have tried this with both custom and garland themes; if someone wants a list of module I have installed, let me know (it's quite long and it's on a live site so I don't want to turn any off right now for testing)
luco, if you post your list of installed modules I'll see if we have any commonalities that could be conflicting.
Comment #2
jstushnoff commentedFound the 'Debug rule evaluation' setting, I get the following message after trying to go to a page that is supposed to trigger the rule (and does, but gives me a white screen), then going to another page (a category) so I can see the message.
I'm noticing that the rule seems to be run twice; with the condition evaluating to FALSE on the second run, any chance that has something to do with it? Any tips as to where I can look in the code (or elsewhere) to fix this? I am becoming more familiar with the Drupal api, but am not familiar with Rules' code yet.
Comment #3
mitchell commentedis not a valid token or path.
Use the path that you set manually in the system settings. By default this is 'node' so that is likely what you are going to use, unless you changed it.
Comment #4
sethviebrock commentedSame issue here. The rule is evaluated *twice* -- first time true, second time false. The page redirect fails to execute for anon users on the first (or second) evaluation of the rule, no matter how hard I try to force it w/ the Rules redirect options (i.e. ignore the destination param, etc). For example, try redirecting anon users from /user/password to an external URL (in our case, an aMember membership mgmt URL).
0 ms "User is going to view a page" has been invoked.
1.636 ms Executing the rule "Redirect user from /user/password to aMember" on rule set "User is going to view a page"
1.861 ms Condition "Path is /user/password" evaluated to TRUE. (**** I check this via arg(0) === 'user' && arg(1) === 'password' ***)
1.975 ms Action execution: "Show a configurable message on the site"
5.086 ms Action execution: "Page redirect"
5.215 ms Evaluation of "User is going to view a page" has been finished.
0 ms "User is going to view a page" has been invoked.
1.602 ms Executing the rule "Redirect user from /user/password to aMember" on rule set "User is going to view a page"
1.831 ms Condition "Path is /user/password" evaluated to FALSE. (**** I check this via arg(0) === 'user' && arg(1) === 'password' ***)
1.886 ms Evaluation of "User is going to view a page" has been finished.
Comment #5
rburgundy commentedsubscribing
Comment #6
les limThe rule isn't firing twice on the original page view. It's firing ONCE for the original page view, redirecting you to a new URL, and then firing again for each new node that it is loaded at that new URL.
An important thing to note is that the rule will be evaluated not just when viewing the full node, but on teasers as well. If the target of the redirect is a URL with teasers, those teasers might cause the rule redirect action to be successfully executed all over again. This is an infinite loop that will never resolve, which I bet is what's causing your white screens.
Try setting further conditions on the rule, such as "Check a truth value" with the value being
echo $page;But including the open and closing php brackets, and all on one line.
Comment #7
fagoComment #8
mitchell commentedClosing old issues. If this issue persists, please try the latest versions and if necessary reopen the issue or create another.