Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've a rule to show user a message when he first visit a page.
I have 3 conditions:
- User has role;
- Data comparison on a profile field;
- Path has URL alias;
No message is shown when I visit the page with the corresponding alias (I've tried with both system URL or path).
Removing the path alias condition makes the rule running fine.
What can be wrong?
I don't have clean url's enabled: could it be a problem?
Comments
Comment #1
mitchell CreditAttribution: mitchell commented>> I don't have clean url's enabled: could it be a problem?
No.
>> Removing the path alias condition makes the rule running fine.
I think you're supposed to fill in a value here, otherwise it will fail every time.
Comment #3
pmichelazzoI have the same issue here. Trying different methods and no one give a result.
Someone have a clue about it?
Thanks
Comment #4
mitchell CreditAttribution: mitchell commented(maintainer note: This obviously isn't very straight forward...)
First off, there isn't a condition in 7.x for "path has alias." You need to use a data comparison with [site:current-page:path] and contains. I think this contains part is the weakest link in usability. There are probably improvements to be made there. Anyway, here's something to try out:
Comment #5
videographics CreditAttribution: videographics commentedI can paste this is and get a rule with a comparison action utilizing the 'contains' operator, but when creating new data comparison actions, "contains" is not an option.
Comment #6
mitchell CreditAttribution: mitchell commented...clarity is a WIP :p
That method was deprecated as of, #1319470: check for multiple selected options. Here's the actual diff:
http://drupalcode.org/project/rules.git/commitdiff/51826e3326df64bfa7eaf...
This was a bit difficult to track down, because the condition names are a bit wonky. "Is" and "Matches" are used in the code interchangeably with "Comparison."
Either way, Text comparison functionally makes more sense for this case than Data comparison, but that will have to be cleared up with improved help text.
If you are still looking for more info on how to set this up, see #1045964: How to do path detection, until there is an actual canonical description in the handbook. Soon........................
Comment #7
videographics CreditAttribution: videographics commentedThanks for the clear run down on what's happening with this. Progress....
Comment #8
ntigh52 CreditAttribution: ntigh52 commentedHo to all,
There is a condition in 7.x for "path has alias." that dont work if i add a condition path = node/3 (for example), Why I need to use a data comparison with [site:current-page:path] and contains.
mitchell helped me a lot to solve the issue with the trick (use data comparison with [site:current-page:path] and contains),
but is ta not a bug ?
THanks/
Comment #9
TR CreditAttribution: TR commentedThis seems to have been answered. Note, "node/3" is not an alias - it is a path. "Path has alias" only works for path alias, that is, an *alternative* path that has been explicitly set for the node. If you edit your node and scroll down to the bottom and click on the "URL path settings" vertical tab, if there is no alias entered in that field then "Path has alias" will return false.
Comment #10
TR CreditAttribution: TR commented