You are here

function login_destination_user in Login Destination 6.2

Same name and namespace in other branches
  1. 6 login_destination.module \login_destination_user()

Implementation of hook_user().

We hook here to redirect.

File

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

Code

function login_destination_user($op, &$edit, &$account, $category = NULL) {
  static $login_destination;

  // If login and not during an installation profile
  if ($op == 'login' && !isset($login_destination)) {
    $login_destination = true;

    // module_invoke_all('user', $op, $edit, $account, $category); // Removed: causing other hook_user calls in other modules to be called twice. Doesn't look like this implementation is doing anything useful anyway
    $arr = login_destination_calculate_redirection_path_and_query($edit);
    $path = $arr[0];
    $query = $arr[1];

    // if condition is ok and this is not the user_login form - redirect. (on the user_login form we set $form['#redirect'] which
    // takes care of the redirection there.)

    //if (__login_destination_should_we_redirect() && $edit['form_id'] != "user_login") {
    if (__login_destination_should_we_redirect($account)) {
      login_destination_redirect_to_path_and_query($path, $query);
    }
  }
}