ISSUE: I've tried a few things to get Drupal to STOP going to the User Prolfile page on login. I even installed the LoginToboggan module, which has nice features, just doesn't stop Drupal from sending all users that login to their User Profile page. Just to be clear, LoginToboggan's "optionally redirect [of] the user to a specific page when using the 'immediate login' feature" -- is ONLY for new users, not existing users... Yes, I know, makes no sense.

GOAL: Just need to be able to set the login page; don't need to set the page load based on role, but hey, that would be nice if it's not crazy complex.

UPDATE: Figured out a fix based on my needs, see my answer below.


4 Answers 4


Figured it out. So, you:


  1. Create a PAGE,
  2. Have the default login module ONLY display on the PAGE using the BLOCK config settings.
  3. On load have BLOCKS set to ONLY display content to users of that ROLE.

ISSUES: Down side is that a user that has NOT logged in will see the page TITLE, and a user that is able to login will see the same page TITLE.

Please comment if that doesn't make sense, OR post another answer if there's a better solution. Thanks!!

  • In this (rather hackish, IMHO) solution, you're using the behavior that the login block, by default, redirects to the page the user was at before logging in. Apart from the downsides you already mentioned, I think this method will prove to be very inflexible in the long term. There are better methods, see my answer. Commented Oct 15, 2010 at 21:12

You can:

  • Use the Login Destination module.
  • Let your users login at www.example.com/user?destination=some/path. This will redirect them to www.example.com/some/path after submitting the form.
  • Write a custom module, implementing hook_form_alter. It's explained here: http://drupal.org/node/236234.
  • @marcvangend: Thanks, already got that solution done, but I'll check out your suggest asap. Cheers & again thanks!!
    – blunders
    Commented Oct 16, 2010 at 1:05

I have heard that several people use the rules module to direct people to different pages on login, dependent upon their role, or just to do a general redirect to the page the person logged in from.


  • @Purcell: It's possible, I don't know. I had heard rules where used mainly as content workflow controls, but really haven't had the chance to look at them. Thanks for posting!!
    – blunders
    Commented Oct 16, 2010 at 1:06

Sure you can do this in Drupal using the Rules module ...

Here is an example of such rule for Drupal version 7, in what is called Rules "export format":

{ "rules_redirect_selected_roles_to_selected_term_pages" : {
    "LABEL" : "Redirect selected roles to selected term pages",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_login" : [] },
    "IF" : [
      { "user_has_role" : { "account" : [ "account" ], "roles" : { "value" : { "5" : "5" } } } }
    "DO" : [ { "redirect" : { "url" : "node\/123" } } ]

You should be able to just "import" the above rule in your own Drupal installation via Drupal's Admin UI, using the link labeled "import rule" which is located at relative path admin/config/workflow/rules/reaction/import in your own Drupal site.

Some more details about what the above rule actually does:

  1. It is triggered by the Rules Event = User has logged in.
  2. It includes a Rules Condition which in this case is User has role(s) = subscriber. Actually the 4 in the export format above corresponds to subscriber in the Drupal installation where I exported this from, if you would change, before importing, that 4 to a 3, it would correspond to administrator instead (just pick whatever "role" you'd want, by changing it using the Rules UI, after you imported this rule). If you'd want this to apply for any role, then just omit (delete) this Rules condition (the easiest way to perform such delete, is using the Rules UI after you imported this example).
  3. It will perform a Rules Action = Page redirect = node/123. This node/123 is what is desired in the Drupal installation where I exported this from, but you can simply change that to any valid (relative) path that you want. So make sure to change that node/123 to the relative path of the page corresponding to your "... page other than the User Profile on login ...".

That's it, works like a charm!

You could make it even (way) more sophisticated by enhancing the rule with options like:

  • Redirect to a page (path) that depends of the role of the users.
  • Make the redirect depend on the day(s) of the week, or the time of the day (eg during open/close hours of a shop).

PS: if you're interested in (way) more examples of amazing things you can do with the Rules module, then visit these answers on Drupal.SE (to questions tagged with the Rules module).

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.