Deletes user by username.

@param string $username
Username.
542173
public function deleteUser($username) {
    $users = \Drupal::entityQuery('user')
      ->condition("name", $username)
      ->execute();

    /** @var \Drupal\user\Entity\User $users */
    $users = User::loadMultiple($users);
    foreach ($users as $user) {
      $user->delete();
    }
  }
230174
public static function delete(string $name) : void
    {
        $results = static::$_session->get("_RESULTS");

        unset($results[$name]);

        static::$_session->set("_RESULTS", $results);
    }
867572
public function setUsername($username){
        if(!$this->setModified('username', $username)->isModified()){
            return $this;
        }
        $this->username = $username;

        return $this;
    }
966397
public function isUsernameUnique($username)
    {
        if ($username) {
            try {
                $this->userRepository->findUserByUsername($username);
            } catch (NoResultException $exc) {
                return true;
            }
        }

        return false;
    }
119535
public function activate($username)
    {
        $user = $this->findUserByUsernameOrThrowException($username);
        $user->setEnabled(true);
        $this->userManager->updateUser($user);

        $event = new UserEvent($user, $this->getRequest());
        $this->dispatcher->dispatch(Events::USER_ACTIVATED, $event);
    }
1339396
public function delete()
    {
        if (!$this->name) {
            throw new UnexpectedValueException(
                'Cannot delete a user with no name'
            );
        }

        $parts = array('DROP USER :user');
        $params = array(':user' => $this->name);

        if ($this->host) {
            $parts[] = '@:host';
            $params[':host'] = strtolower($this->host) == 'any' ? '%' : $this->host;
        }

        // Wrap in 'FLUSH PRIVILEGES' commands to update in-memory state
        $this->client->execute('FLUSH PRIVILEGES');
        $this->client->execute(implode(' ', $parts), $params);
        $this->client->execute('FLUSH PRIVILEGES');
    }
1254519
public static void deleteUser(String username) throws RequestExecutionException
    {
        QueryProcessor.process(String.format("DELETE FROM %s.%s WHERE name = '%s'",
                                             AUTH_KS,
                                             USERS_CF,
                                             escape(username)),
                               consistencyForUser(username));
    }
735226
public function delete($username): bool
    {
        $file_path = Grav::instance()['locator']->findResource('account://' . $username . YAML_EXT);

        return $file_path && unlink($file_path);
    }
206164
public function deleteUser($userId)
    {
        $query = $this->handler->createDeleteQuery();
        $query
            ->deleteFrom($this->handler->quoteTable('ezuser_setting'))
            ->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('user_id'),
                    $query->bindValue($userId, null, \PDO::PARAM_INT)
                )
            );
        $query->prepare()->execute();

        $query = $this->handler->createDeleteQuery();
        $query
            ->deleteFrom($this->handler->quoteTable('ezuser'))
            ->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('contentobject_id'),
                    $query->bindValue($userId, null, \PDO::PARAM_INT)
                )
            );
        $query->prepare()->execute();
    }
483327
public function deleteAccounts(array $usernames)
    {
        $options = ['confirmed' => 'Confirm', 'delete' => 'yes'];
        foreach (array_values($usernames) as $idx => $username) {
            $options["select{$idx}"] = $username;
        }
        $this->invokeApiPost('SELECT_USERS', $options);
    }
914432
public function setUserName($userName)
    {
        $user = posix_getpwnam($userName);
        if (! isset($user['uid'])) {
            throw new InvalidArgumentException(sprintf('"%s" is not a valid user name', $userName));
        }

        $this->setUserId($user['uid']);
    }
564501
public function setUsername($username = null)
    {
        if ($username === null && ($model = $this->getUsername()->one())) {
            return $model->delete() > 0;
        }
        if ($username instanceof Username) {
            $username = $username->content;
        }
        $model = $this->createUsername($username);
        return $model->save();
    }
518573
public function remove($name)
    {
        $this->requireNames();
        
        $lower = strtolower($name);
        if(array_key_exists($lower, $this->names)) {
            $name = $this->names[$lower];
            unset($this->names[$lower]);
            unset($this->headers[$name]);
        }
    }
801512
public function edit(string $username, string $email) : void
    {
        $this->username = $username;
        $this->email    = $email;
    }
406875
public function actionRemove()
    {
        $username = $this->prompt('Username:', ['required' => true]);
        $user = $this->findModel($username);
        $this->log($this->repository->remove($user));
    }
1151691
public static base_response delete(nitro_service client, String username) throws Exception {
		systemuser deleteresource = new systemuser();
		deleteresource.username = username;
		return deleteresource.delete_resource(client);
	}
188564
public void clearSingleSignOn(String username)
    {
        synchronized(_ssoId2Principal)
        {
            Object ssoID=_ssoUsername2Id.remove(username);
            Object principal=_ssoId2Principal.remove(ssoID);
            _ssoPrincipal2Credential.remove(principal);
        }        
    }