By tstoeckler on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
format_username()has been renamed touser_format_name()because it is now inuser.module.- Accordingly,
hook_username_alter()has been renamed tohook_user_format_name_alter().
Only the names have changed; both the function and the hook are functionally identical to their Drupal 7 versions.
Example:
// Drupal 7
$username = format_username($user);
/**
* Implements hook_username_alter().
*/
function MYMODULE_username_alter(&$name, $account) {
// Do whatever.
}
// Drupal 8
$username = user_format_name($user);
/**
* Implements hook_user_format_name_alter().
*/
function MYMODULE_user_format_name_alter(&$name, $account) {
// Do exactly the same thing here.
}
Impacts:
Module developers
Themers