function UserSession::getAccountName

Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Session/UserSession.php \Drupal\Core\Session\UserSession::getAccountName()
  2. 10 core/lib/Drupal/Core/Session/UserSession.php \Drupal\Core\Session\UserSession::getAccountName()
  3. 11.x core/lib/Drupal/Core/Session/UserSession.php \Drupal\Core\Session\UserSession::getAccountName()

Returns the unaltered login name of this account.

Return value

string An unsanitized plain-text string with the name of this account that is used to log in. Only display this name to admins and to the user who owns this account, and only in the context of the name used to login. For any other display purposes, use \Drupal\Core\Session\AccountInterface::getDisplayName() instead.

Overrides AccountInterface::getAccountName

File

core/lib/Drupal/Core/Session/UserSession.php, line 158

Class

UserSession
An implementation of the user account interface for the global user.

Namespace

Drupal\Core\Session

Code

public function getAccountName() {
    return $this->name;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.