function drush_user_login

8.0.x user.drush.inc drush_user_login($inputs = '', $path = NULL)
6.x user.drush.inc drush_user_login($user = NULL, $path = NULL)
7.x user.drush.inc drush_user_login($inputs = '', $path = NULL)
4.x user.drush.inc drush_user_login($name = NULL)
5.x user.drush.inc drush_user_login($user = NULL, $path = NULL)
master user.drush.inc drush_user_login($inputs = '', $path = NULL)

Displays a one time login link for the given user.

1 string reference to 'drush_user_login'
user_drush_command in commands/user/user.drush.inc
Implementation of hook_drush_command().

File

commands/user/user.drush.inc, line 370
Drush User Management commands

Code

function drush_user_login($name = NULL) {
  if (empty($name)) {
    $user = user_load(1);
    $name = '[uid 1]';
  }
  elseif (drush_drupal_major_version() >= 7) {
    $user = user_load_by_name($name);
  }
  else {
    $user = user_load(array('name' => $name));
  }

  if ($user !== FALSE && $user->status) {
    $link = user_pass_reset_url($user);
    drush_print($link);
    return $link;
  }
  else {
    drush_set_error("The user account with the name " . $name . " could not be loaded or is blocked!");
  }
}