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

davexd’s picture

I'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 :)

entr3p’s picture

Same. 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 :).

entr3p’s picture

Priority: Normal » Critical
AlexisWilke’s picture

Category: support » bug

Hi 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

fago’s picture

Category: bug » support

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

fago’s picture

Category: bug » support
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

derekahmedzai’s picture

It's probably too late for the original poster, but here's how I managed to check the current path (for user/register):

  1. Enabled PHP filter core module
  2. Created a textual comparison condition with these values:
    • <?php echo $_GET['q']; ?>
    • user/register
BenK’s picture

Subscribing.... the solution in #8 worked for me. Thanks DerekAhmedzai!

tonyoconnell’s picture

Hello...

To get the path alias working you can use this PHP code

$url = drupal_get_path_alias($_GET['q']);
return strstr($url, 'user/login');

ressa’s picture

Version: 6.x-1.x-dev » 6.x-1.2

To 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-out

2. Rule:
Show logout message
Event: Content is going to be viewed
IF
Two texts to compare: *
<?php echo $_GET['status']; ?>
logged-out
DO
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:

/* logout message */
.logged-out {
  background:#ddd none repeat scroll 0 0;
  border:1px solid #ccc;
  font-size:1.5em;
  margin:0 0 0.5em;
  padding:0 0.2em;
}
heyMP’s picture

I know this is closed but i think this module is what you are looking for http://drupal.org/project/pathrules

ressa’s picture

Thanks 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

calefilm’s picture

Thank you MGP140!

drupalreggie’s picture

Im 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

mitchell’s picture

Component: Miscellaneous » Rules Core

Updated component.

nielsvoo’s picture

Issue summary: View changes

I 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

<?php
	$url = (!empty($_SERVER['HTTPS'])) ? 
	"https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : 
	"http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
	$parts = parse_url($url);
	$path_parts= explode('/', $parts[path]);
	$user = $path_parts[2];
	echo $user; // **echo's third part of url**
?>

Nielsvoo