public function AccountInterface::getUsername in Drupal 8
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 log in. For any other display purposes, use \Drupal\Core\Session\AccountInterface::getDisplayName() instead.
Deprecated
in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Session\AccountInterface::getAccountName() or \Drupal\user\UserInterface::getDisplayName() instead.
See also
https://www.drupal.org/node/2572493
3 methods override AccountInterface::getUsername()
- AccountProxy::getUsername in core/
lib/ Drupal/ Core/ Session/ AccountProxy.php - Returns the unaltered login name of this account.
- User::getUsername in core/
modules/ user/ src/ Entity/ User.php - Returns the unaltered login name of this account.
- UserSession::getUsername in core/
lib/ Drupal/ Core/ Session/ UserSession.php - Returns the unaltered login name of this account.
File
- core/
lib/ Drupal/ Core/ Session/ AccountInterface.php, line 121
Class
- AccountInterface
- Defines an account interface which represents the current user.
Namespace
Drupal\Core\SessionCode
public function getUsername();