Need some help with your project? Contact me

Cool module: Login Destination

Login Destination is one of those simple Drupal modules that help with a very specific requirement. It allows for configuring some light rules that redirect the user to a custom location after logging in, registering for an account or logging out.

The module very well exemplifies the Drupal saying: there’s a module for that. And more so, puts the saying easily into a conversation with your client:

  • Client: '...but I want the user to be redirected to my cupcake gallery after logging in'
  • You: 'it’s ok, there’s a module for that.'

So to use it, you have to install it like any module and go to its configuration page: admin/config/people/login-destination. There you can add multiple login destination rules that require some minimal configuration.

Add a rule and immediately you’ll see a text box where you have to put the internal or external destination URL to be used by this rule. Next, you select the triggers for the redirect: login, registration, one-time login link and logout or all of them together. Moreover, you can select a condition: the page the user is currently on when performing the said actions.

To top it all off, you can further narrow the rule down by selecting which permission role the user must have in order to be redirected. This will allow you to create various behaviours for the different user categories you may have. So that’s pretty much it you have to do.

If you’re a fan of video learning, there is an episode of the Daily Dose of Drupal dedicated to this module. I recommend you check it out.

Hope this helps.

Some related articles you might enjoy


Naturally, you can achieve this task with Rules very effectively and flexibly, so if you're already tied to using that, you won't have need for the above module as well. Otherwise, sounds good! :)

I realise this module would be great for someone that wants a light weight solution but wouldn't the Rules module do this without breaking a sweat?

The r4032login module solved my problem of returning anonymous users a restricted page after logging in. It was also able to preserve entityreference_prepopulate values when logging in to complete a node/form submission. Login Destination may be able to do similar, but I was not able to get it to preserve the entityreference_prepopulate values from the url.

Add new comment

You can post comments in Markdown and basic HTML tags.
For code blocks, wrap your code within '~~~'. For example:
$var = 'my variable';