This is related to this question:

How do I redirect a user role on login (Drupal 6)?

My biggest problem is that the only rules available as far as I can see are on user login, period, nothing for a specific role. How would I go about setting the redirect ONLY for certain user roles, when using rules?

  • I would have done a write up for this but after a quick google. Everything I was going to cover is on this page: http://drupal.org/node/683696. The solution for your specific case seems to be the login_destination module. If you read in the description; > It is possible to specify certain conditions like referring pages or > user roles and make the destination depend upon them. – Digital fire Jul 9 '12 at 17:11
  • Seems to be for "user" specifically, not a specific user role. – Jack Ryan Jul 9 '12 at 17:32
  • I edited my answer. Check it out and let me know how it turns out. – Digital fire Jul 9 '12 at 17:52

In rules you could select "when a user logs in" and then as the action, select "custom php code" and fiddle with something along the lines of:

if (in_array('ROLE_TO_CHECK', array_values($account->roles))) {



Rules can do this....

  1. Select 'Add a new rule'
  2. Name it whatever and select 'User has logged in' as the event
  3. Add a condition: User has role(s)
  4. Select the role you want
  5. Add an action.
  6. Select Page Redirect
  7. Enter the path you want ADDITION: check both Force Redirect and Immediate Issue check boxes
  8. Save
  • Eek, the only way to do it is with custom code? – Jack Ryan Jul 9 '12 at 16:53
  • I can do it, but the client might balk at it. – Jack Ryan Jul 9 '12 at 16:53
  • Does this work in Drupal 6? – Jack Ryan Jul 9 '12 at 17:32
  • It worked here (D6) with Rules 6.x-1.4 – Jimajamma Jul 9 '12 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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