function user_format_name

Format a username.

Parameters

\Drupal\Core\Session\AccountInterface $account: The account object for the user whose name is to be formatted.

Return value

string An unsanitized string with the username to display.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use $account->label() or $account->getDisplayName() instead

See also

https://www.drupal.org/node/3050794

1 call to user_format_name()
UserLegacyTest::testUserFormatName in core/modules/user/tests/src/Kernel/UserLegacyTest.php
Tests user_format_name().

File

core/modules/user/user.module, line 463

Code

function user_format_name(AccountInterface $account) {
    @trigger_error('user_format_name() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use $account->label() or $account->getDisplayName() instead. See https://www.drupal.org/node/3050794', E_USER_DEPRECATED);
    return $account->getDisplayName();
}

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