Drupal all ready contains a function to redirect the user after login in login.module. This should be updated for version 3.x and 5.x accordingly.

The API is here:

http://api.drupal.org/api/drupal/modules%21user%21user.module/function/u...

Code:

function user_login_destination() {
  $destination = drupal_get_destination();
  if ($destination['destination'] == 'user/login') {
    $destination['destination'] = 'user';
  }
  return $destination;
}

Comments

13rac1’s picture

Status: Active » Closed (duplicate)