Login Destination

This module controls where users go after logging in. You can configure login destination on a settings page. It will be either static URL or a PHP snippet evaluating your own site's logic. You can also configure which pages redirection is applied.

To achieve this you can specify either a list of URLs or a PHP snippet to build this list dynamically. So, you can redirect user to various pages depending on which pages they are logging from.

In the last 5.0 release you can also use alias URLs instead of internal paths.

Developed by ARDAS group - Web solutions development, Drupal CMS and Software outsourcing.

PHP snippet for redirection URL should return a string. Here is an example:

  global $user;
  if ($user->uid == 1) {
    // Redirect the Administrator
    return 'admin';
  } elseif ($user->uid == 2) {
    // Redirect the Site Owner to the 'create content' page
    return 'node/add';
  } else {
    return 'node';
  }

PHP snippet for Redirection condition should return boolean value. An example is:

  return ($_GET['q'] == 'user/login');

Don't put PHP tags when creating snippets.

Turn on "Preserve destination" feature to make module sensible to destination parameter. When login from the path with specified destination (ex: 'any-page?destination=node/18') you will be taken to node/18 instead of the URL specified in login_destination settings.

DRUPAL 5:
-------------
$_SESSION['login_page'] was added and stores the page you were before clicking login form button. You can use it to determine the page you logged from instead of $_GET['q'] because $_GET['q'] always equals to 'login_redirect'.

DRUPAL 6:
-------------
Now you can use $_GET['q'] to find out internal path and $_REQUEST['q'] for alias of the page you have logged in from.

Releases

Official releasesDateSizeLinksStatus
6.x-2.12008-Aug-049.53 KBRecommended for 6.xThis is currently the recommended release for 6.x.
5.x-1.02007-Apr-207.43 KBRecommended for 5.xThis is currently the recommended release for 5.x.
Development snapshotsDateSizeLinksStatus
5.x-1.x-dev2008-Jan-2510.25 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
4.7.x-1.x-dev2007-Jan-146.74 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
 
 

Drupal is a registered trademark of Dries Buytaert.