function _drush_user_info

6.x user.drush.inc _drush_user_info($uid)
2 calls to _drush_user_info()
drush_user_information in commands/user/user.drush.inc
Prints information about the specified user(s).
_drush_user_print_info in commands/user/user.drush.inc
Print information about a given uid

File

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

Code

function _drush_user_info($uid) {
  if (drush_drupal_major_version() >= 7) {
    $userinfo = user_load($uid);
  }
  else {
    $userinfo = user_load(array('uid' => $uid));
  }
  $userinfo = (array) $userinfo;
  unset($userinfo['data']);
  unset($userinfo['block']);
  unset($userinfo['form_build_id']);
  foreach (array('created', 'access', 'login') as $key) {
    $userinfo['user_' . $key] = format_date($userinfo[$key]);
  }
  // Note: in D8, $userinfo->roles may not contain the human-readable role names.
  // For example, it may contain 'authenticated' => 'authenticated' instead of
  // 'authenticated' => 'Authenticated user'.  In any event, we display the
  // machine name rather than the human-readable name for better output-conformity
  // with D6 and D7.
  if (drush_drupal_major_version() >= 8) {
    $userinfo['user_roles'] = $userinfo['roles'];
    $userinfo['roles'] = array_keys($userinfo['roles']);
  }
  $userinfo['user_status'] = $userinfo['status'] ? 'active' : 'blocked';
  return $userinfo;
}