You are here

public function User::getUsername in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Entity/User.php \Drupal\user\Entity\User::getUsername()

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::getUsername

Deprecated

in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Session\AccountInterface::getAccountName() or \Drupal\user\UserInterface::getDisplayName() instead.

File

core/modules/user/src/Entity/User.php, line 364
Contains \Drupal\user\Entity\User.

Class

User
Defines the user entity class.

Namespace

Drupal\user\Entity

Code

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