Event:
User is going to view a page
Condition:
"Path has asias(es)"
It always returns false. I tried this on two websites and no dice. I have "Debug rule evaluation" running and it always returns false. What i'm trying to do is add a "Account Settings" in menus so I'm trying to redirect from "user/edit" to "user/[user:uid]/edit" as I can't dynamically change the url from menus.
* 0 ms User is going to view a page has been invoked.
* 20.548 ms Executing the rule User Edit Redirect on rule set User is going to view a page
* 22.788 ms Loaded variable acting user
* 66.951 ms Condition Path has alias(es) evaluated to FALSE.
* 67.09 ms Evaluation of User is going to view a page has been finished.
Note: Page redirect works with everything else, such as on login.
Comments
Comment #1
davexd commentedI'm having the same problem.
If I set "path has alias(s)" to:
http://example.com/test-alias-name it returns FALSE when I go to that page.
If I set "path has alias(s)" to:
http://example.com/node/7 it always returns TRUE when I go to ANY page!
Keen for an update :)
Comment #2
entr3p commentedSame. I love the Rules module as it's an extremely strong and versatile tool but this is something really important which I need right now...hopefully we get an update soon :).
Comment #3
entr3p commentedComment #4
AlexisWilke commentedHi guys,
I think you may be using it the wrong way around.
"Path has alias(es)" means that you are testing whether a node has an alias (i.e. was node/7 given an alias?)
"URL alias exists" means that you are testing whether an alias exists (i.e. is sitemap an alias to some node?)
Either way it won't work for "aliases" automatically added by modules. So if you install the sitemap module, you get a sitemap "alias", but these functions will not find it.
@Davexd: therefore, if node/7 has an alias, it has an alias, wherever you are on your website.
Let us know if that fixes your problem.
Thank you.
Alexis Wilke
Comment #5
fagothanks, alex I think you got the point.
>So if you install the sitemap module, you get a sitemap "alias", but these functions will not find it.
Except for this one, the alias of modules should work too. However if a module defines just a path "sitemap", there is usually no alias for it.
Comment #6
fagoComment #8
derekahmedzai commentedIt's probably too late for the original poster, but here's how I managed to check the current path (for user/register):
<?php echo $_GET['q']; ?>user/registerComment #9
BenK commentedSubscribing.... the solution in #8 worked for me. Thanks DerekAhmedzai!
Comment #10
tonyoconnell commentedHello...
To get the path alias working you can use this PHP code
$url = drupal_get_path_alias($_GET['q']);
return strstr($url, 'user/login');
Comment #11
ressaTo do this create two rules, where the log out landing page is going to be
123examplewebsite.com/down-uploads?status=logged-out
1. Rule:
Redirect logged out user to Down- & Uploads
Event: User has logged out
DO
Page redirect:
down-uploads?status=logged-out2. Rule:
Show logout message
Event: Content is going to be viewed
IF
Two texts to compare: *
<?php echo $_GET['status']; ?>logged-outDO
Show a configurable message on the site
<div class="logged-out">You are now logged out, thank you for visiting.</div>CSS for the message:
Comment #12
heyMP commentedI know this is closed but i think this module is what you are looking for http://drupal.org/project/pathrules
Comment #13
ressaThanks mgp140, that was just what I was looking for back then! I posted an example of how you can use the module here: http://drupal.org/node/380344#comment-3706654
Comment #14
calefilm commentedThank you MGP140!
Comment #15
drupalreggie commentedIm trying to implement the solution in #8
after my users attempt to register with a denied email address they are taken to "user/register?destination=user"
I'd like to redirect them away from this page using rules
Currently I've got
Event 'Content is going to be viewed'
Condition 'Textual comparison'
echo $_GET['q'];-----
user/register
But no rule is triggered when viewing 'user/register?destination=user' , or even when I refresh the page and get the true URL: 'user/register'.
Any ideas?
Cheers,
Drupalreg
Comment #16
mitchell commentedUpdated component.
Comment #17
nielsvoo commentedI fixed it using php in a custom token with some php code to get the variable out of the URL, by adding this custom token to the $site token part it is always available in my site as global token.
here is the code for the Token
Nielsvoo