Login Destination: Sending us where we need to go!
Rare is the site where the user who logs in, and needs to end up on their User page. This is the default behavior of Drupal. It makes sense if you are making a community or social media type website. But for most of us, building publishing, marketing, and general business sites, we want to send our users to a specific place so they can start or continue their workflow.
The Drupal Login Destination module comes to our rescue. With this module, we can redirect a user after logging in, after registering to the site, after using a one-time login link, or after logging out. We can set rules based on the user's Role, and can direct users to internal or external links, keeping any variables needed. It is a very powerful tool that you can use to help administrators on their way into their work, or help users into a conversion funnel of your design.
Installing Login Destination
Installation is simple, download to your modules folder and enable to the modules screen, or do so using drush:
drush dl -y login_destination
drush en -y login_destination
- After installation, visit:
- /admin/config/people/login-destination or
- Admin Menu > Configuration > People > Login destinations
- Click the "Add login destination rule" button and a new screen will present itself.
- Redirect to page: Enter the Internal page or external URL
- Redirect upon triggers: Set the trigger that this redirect will happen upon. Your options are:
- Login, registration, one-time login link
- Logout
- All
- Redirect from specific pages: You can set this rule to be used on specific pages. Examples include the login page, a 404 or a 403, or even a specific landing page! You can set to be:
- All pages except those listed
- Only the listed pages
- Redirect users with roles: Set the rule based on the role of the user.
- Weight: In case there are rules that are similar, you can add a weight to order them.
Login Destination is a great, simple helper module that gives Site Builders a method to direct users to destinations based on simple actions. Below you will find some common recipes that I have used.
Common Login Destination Recipes
Redirect to Home Page after Logout
- Redirect to page: <front>
- Redirect upon triggers: Logout
- Redirect from specific pages: All pages except those listed - [none]
- Redirect users with roles: All Roles Selected
Redirect Content Editors to admin/content
- Redirect to page: admin/content
- Redirect upon triggers: Unchecked, lists all
- Redirect from specific pages: All pages except those listed - user/logout
- Redirect users with roles: Administrator, Webmaster, Content Editor
Redirect to Twitter/Facebook after Logout for Subscribers
- Redirect to page: http://www.twitter.com/thejimbirch
- Redirect upon triggers: Logout
- Redirect from specific pages: All pages except those listed - [none]
- Redirect users with roles: Subscribers
Redirect to Page after Landing Page Login
- Redirect to page: /landing-page-success
- Redirect upon triggers: Login, registration, one-time login link
- Redirect from specific pages: /landing-page-url *
- Redirect users with roles: All Roles Selected
*Add a register or login block to a specific URL using Panels, Context or your preferred method of content placement.