Suspends (or unsuspends) multiple accounts.

@param string[] $usernames Accounts to delete
@param bool $suspend (true - suspend, false - unsuspend)
325314
public function suspendAccounts(array $usernames, $suspend = true)
    {
        $options = ['suspend' => $suspend ? 'Suspend' : 'Unsuspend'];
        foreach (array_values($usernames) as $idx => $username) {
            $options['select' . $idx] = $username;
        }
        $this->invokeApiPost('SELECT_USERS', $options);
    }
938924
public static function removeByUsername(string $username) {
		$userdbname = setup::getValidation("username");
		if ($user = R::findOne('user', ' ' . $userdbname . ' = ? ', [$username])) {
			R::trash($user);
		}
	}
515699
protected function invalidateUsername($username)
    {
        $this->_mixer->set('body', AnHelperString::str_ireplace('@'.$username, $username, $this->_mixer->body));
    }
413800
public function deactivate($username)
    {
        $user = $this->findUserByUsernameOrThrowException($username);
        $user->setEnabled(false);
        $this->userManager->updateUser($user);

        $event = new UserEvent($user, $this->getRequest());
        $this->dispatcher->dispatch(Events::USER_DEACTIVATED, $event);
    }
1311363
public function suspend()
    {
        RevisionRepository::create([
            'revisionable_type' => Config::get('sentry.users.model'),
            'revisionable_id'   => $this['user_id'],
            'key'               => 'suspended_at',
            'old_value'         => $this['suspended_at'],
            'new_value'         => new DateTime(),
            'user_id'           => null,
        ]);

        parent::suspend();
    }
218929
final public static function deleteOtpToken (string $username)
	{
		if ($username == $_SESSION['username']) {
			$tokenValue 				= NULL;
			$tokenTime 					= NULL;
			$_SESSION['otp_token'] 		= NULL;
			$_SESSION['otp_token_time'] = NULL;
		}
		return self::setUserOtpToken($username, $tokenValue);
	}
1094907
public function setUserBlockedStatus($username, $blocked = true)
    {
        $this->username = $username;
        $this->getMeta()->blocked = $blocked;
        $this->getMeta()->save();
    }
337217
public function revokeSessions($username, $session = '')
    {
        $this->username = $username;
        if ($session == '') {
            $newSessions = [];
        } else {
            $sessions = $this->getMeta()->sessions;

            $newSessions = [];
            foreach ($sessions as $s) {
                if ($s['sid'] != $session) {
                    $newSessions[] = $s;
                }
            }
        }

        $this->getMeta()->sessions = $newSessions;
        $this->getMeta()->save();
    }
1013412
public function removeUsers($users)
    {
        if (is_array($users)) {
            foreach ($users as $id) {
                $this->users()->detach($id);
            }

            return $this;
        }

        $this->users()->detach($users);

        return $this;
    }
80340
public function logout($username = null)
    {
        return $this->performRequest('/status/user/'.(is_null($username) ? $this->user
                    : $username).'/logout', 'POST');
    }
932344
public static function offMulti(array $names)
    {
        foreach ($names as $value) {
            list($class, $name) = $value;
            static::off($class, $name);
        }
    }
164604
public function unassignRole($roleName, $userId)
    {
        $role = $this->role->findByName($roleName);
        $user = $this->model->find($userId);

        $user->roles()->detach($role);
    }
979217
public function offsetUnset($offset)
    {
        if (!$this->offsetExists($offset)) {
            throw new InvalidNameException(sprintf("The offset '%s' doesn't exist in this String vector", $offset));
        }

        unset($this->collection[$offset]);
    }
1225276
def remove(self, username=None):
        """"""
        self._user_list = [user for user in self._user_list if user.name != username]
722389
public function createAccount($userNames)
    {
        if (!is_array($userNames)) {
            $userNames = array($userNames);
        }

        foreach ($userNames as $userName) {
            if (empty($userName)) {
                continue;
            }

            if (!in_array($userName, $this->getLocalAccounts())) {

                //Do a sanity check
                if ($this->userNameExists($userName) === false) {

                    try {
                        $userId = wp_insert_user(
                            array(
                                'user_login' => $userName,
                                'user_pass' => wp_generate_password(),
                                'user_nicename' => $userName,
                                'user_email' => $this->createFakeEmail($userName),
                                'user_registered' => date('Y-m-d H:i:s'),
                                'role' =>  $this->defaultRole
                            )
                        );
                    } catch (\Exception $e) {
                        error_log("Error: Could not create a new user using bulk data (ad-api-integration).");
                    }

                } else {
                    $userId = null;
                }

                if (is_numeric($userId)) {
                    $this->setUserRole($userId);
                }
            }
        }
    }
413416
public static function isExistByUsername( $username ) {

		$user = self::find()->where( 'username=:username', [ ':username' => $username ] )->one();

		return isset( $user );
	}
490802
def delete_user(self, username):
        
        path = Client.urls['users_by_name'] % username
        return self._call(path, 'DELETE')