0

Using the modules "rules" and "rules linkevent" I am trying to get drupal to automatically assign a new role to the user upon visiting a certain page.

I've written it like this/entered the following values and selected these options:

-

Events Event
levelup2 was accessed

-

Conditions Elements

User has role(s) Parameter: User: [site:current-user], Roles: authenticated user

-

Actions Elements

Add user role Parameter: User: [site:current-user], Roles: Level 2


What am I doing wrong or how could I alternatively make the user accessing the page, reading the page or another trigger I can make be granted a new role?

I have tried searching the net but have found no answers. Can anyone help?

2
  • Can you put that rule statements here ?
    – Rupesh
    May 1, 2014 at 1:20
  • What do you mean? I put what the info in my post?
    – Ithxi
    May 1, 2014 at 4:02

2 Answers 2

0

The Rules Path and Rules URL Argument modules trigger events based on the current URL being viewed.

You could also use the Rules Link module to generate a custom link that will trigger your rules. The catch here is that this specific link must be clicked to access the page and the user I believe must be signed in.

If you need fine tuned control over when the Rules event is triggered you could even implement your own Rules Event.

4
  • Thank you for the reply! Sadly I still can't seem to get it right. I set the event to "url" was visited. I set the path (in conditions) to "check url" and set it to the given page. I set the action to "grant role" Yet it does not seem to work?
    – Ithxi
    May 1, 2014 at 4:12
  • You may need to use the system path instead of an alias. I've also added drupal.org/project/rules_url_argument to the answer above. :)
    – Citricguy
    May 1, 2014 at 4:15
  • Still can't get it to work. I've tried button fields.. I've tried all the modules you suggest but yet I can't seem to find a way to activate a trigger that is only placed on one specific node. Neither of the sites work with URL (Neither custom page nor a node). I think I might be better off asking someone to write the necessary code for a new custom module.. This is horrible o.O Have spent +10 hours on this single problem now
    – Ithxi
    May 2, 2014 at 3:50
  • I will mark this post as answered simply because it should answer most other users questions in relation to this. I might just be an idiot for not getting it to work
    – Ithxi
    May 3, 2014 at 4:22
0

You could use page manager with the rules bonus pack to achieve what you want. Watch this screen cast: http://vimeo.com/25153525

Your Answer

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

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