Login Destination is a module that allows you to specify which page the user sees after logging in. One very common use is to redirect users to the page they were viewing before they logged in.
Login Destination is available for both Drupal 6 and 7. In this tutorial we cover D6 because that is the version used by the student who requested this tutorial. However, the only difference for D7 users will be the installation process.
Step 1. Download and install the module
- Download the module from http://drupal.org/project/login_destination
- Decompress it and place the folder into /sites/all/modules. You may need to create the modules directory if you don't find one already created.
Step 2. Enable the module
- Go to Administer then Site Building then Modules.
- Check the Enabled Box.
- Click Save configuration.
Step 3: Adjust permissions
Go to Administer then User management then Permissions to change permissions.
You only need to do this if you want registered users other than the top level administrator to have access to this module.
Step 4. Configure the module
- Go to Administer then User management and finally then Login Destination to find the configuration page.
- Notes: Always: Redirection happens always. Redirect condition field is ignored.
- List of paths mode: Enter a list of paths, one path per one line. Redirection will happen only when logging from specified pages. Example paths are contact or user/login.
- PHP snippet mode: Enter PHP code if you need to do calculations to detemine if the user should be redirected (if they are assigned to a certain user role, for example). It should return either a string value or an array and PHP opening and closing tags are not required.
- Notes: Static URL mode: Enter a static path. Do not use a GET query at the end here. Only the first line of text will be used. Example paths are node/add or contact.
- PHP snippet mode: Enter PHP code if you need to do calculations to detemine where the user should go (a personalised URL, for example). It should return either a string value or an array and PHP opening and closing tags are not required.
- The simplest and method is to simply check the box that says, "Return User to his/her destination"