You are here

function login_destination_user_login in Login Destination 7

Same name and namespace in other branches
  1. 8.2 login_destination.module \login_destination_user_login()
  2. 8 login_destination.module \login_destination_user_login()

Implements hook_user_login().

File

./login_destination.module, line 283
Control where users are directed to, once they login

Code

function login_destination_user_login(&$edit, $account) {
  $password_reset = FALSE;
  if (isset($_POST['form_id'])) {
    $form_exception = 'user_pass_reset';
    if (module_exists('change_pwd_page')) {
      $form_exception = 'change_pwd_page_user_pass_reset';
    }
    $password_reset = $_POST['form_id'] === $form_exception;
  }
  elseif (($arg = arg()) && count($arg) === 6) {
    $password_reset = $arg[0] === 'user' && $arg[1] === 'reset' && $arg[5] === 'login';
  }
  if (!$password_reset || variable_get('login_destination_immediate_redirect', FALSE)) {
    login_destination_perform_redirect('login');
  }
}