1

I have a Views page, located at, say, www.example.com/entrepreneur.

When a user accesses that particular url, I want some rule to be executed.

I've looked at the Rules admininistration page to find out what exactly I should use as (the mandatory) "React on event", which looks like so:

enter image description here

But I am not able to find "page is viewed", but I need to execute the rule when user accesses the particular single page.

Any suggestions?

2 Answers 2

0

You need to download Rules module ,Rule_link module Token module

  1. Enable Rule and Rule link and Token module
  2. Go to /admin/config/workflow/rules_links
  3. Add a new rule_link, Give the rule label and all other required field
  4. Click on Configure rules tab and in access conditions you can add your conditions
1
  • Sorry @Yama, but the Rules_Link module is to "create links which trigger arbitrary functionality with the help of Rules" ... That is not at all what this question is about ... I think. Or am I missing something why you think this module does indeed help to answer this question? Commented Feb 23, 2016 at 19:07
0

Let's assume that the Rules action that you want to trigger is to just set a Drupal message like "Hi there ...". But this action should only be triggered when "Viewing the content" located at a path like "/entrepreneur".

To get this to work, use the rule below (in Rules export format, just import it in your site and check the results of it):

{ "rules_visit_view_with_path_entrepreneur" : {
    "LABEL" : "Visit view with path entrepreneur",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "site:current-page:path" ], "value" : "/entrepreneur" } }
    ],
    "DO" : [ { "drupal_message" : { "message" : "Hi there" } } ]
  }
}

The rule above should be close to what you're looking for, except maybe from these further refinements:

  • Replace the Rules Action by your own "Rules Action" (which you didn't specify).
  • This Rules Action will be performed before your content located at /entrepreneur is actually shown. That implies you could also issue some redirect (to another path) for whatever reason (so that the content located at some other URL would be shown instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.