class UserSingle7

  1. 8.0.x lib/Drush/User/UserSingle7.php UserSingle7
  2. 7.x lib/Drush/User/UserSingle7.php UserSingle7
  3. master lib/Drush/User/UserSingle7.php UserSingle7




Expanded class hierarchy of UserSingle7


Contains filters are case sensitive
Namesort descending Modifiers Type Description
UserSingle7::addRole public function Add a role to the current user. Overrides UserSingleBase::addRole
UserSingle7::block public function Block a user from login. Overrides UserSingleBase::block
UserSingle7::getUsername public function Get a user's name. Overrides UserSingleBase::getUsername
UserSingle7::id public function Return an id from a Drupal user account. Overrides UserSingleBase::id
UserSingle7::info function A flatter and simpler array presentation of a Drupal $user object. Overrides UserSingleBase::info
UserSingle7::passResetUrl public function Build a one time login link. Overrides UserSingleBase::passResetUrl
UserSingle7::password function Change a user's password. Overrides UserSingleBase::password
UserSingle7::removeRole public function Remove a role from the current user. Overrides UserSingleBase::removeRole
UserSingle7::unblock public function Unblock a user from login. Overrides UserSingleBase::unblock
UserSingleBase::$account public property
UserSingleBase::cancel public function Block a user and remove or reassign their content.
UserSingleBase::__construct public function


lib/Drush/User/UserSingle7.php, line 5

View source
class UserSingle7 extends UserSingleBase {

  public function block() {

  public function unblock() {

  public function addRole($rid) {
    user_multiple_role_edit(array($this->account->uid), 'add_role', $rid);

  public function removeRole($rid) {
    user_multiple_role_edit(array($this->account->uid), 'remove_role', $rid);

  function info() {
    $userinfo = (array) $this->account;
    foreach (array('created', 'access', 'login') as $key) {
      $userinfo['user_' . $key] = format_date($userinfo[$key]);
    $userinfo['user_status'] = $userinfo['status'] ? 'active' : 'blocked';
    return $userinfo;

  public function passResetUrl($path = '') {
    $options = array();
    if ($path) {
      $options['query']['destination'] = $path;
    // D6,D7 append a /login. Otherwise identical to D8+.
    return drush_url(user_pass_reset_url($this->account) . '/login', $options);

  function password($pass) {
    user_save($this->account, array('pass' => $pass));

  public function getUsername() {
    return $this->account->name;

  public function id() {
    return $this->account->uid;