/** * Implements hook_user_format_name_alter(). */ function {{ machine_name }}_user_format_name_alter(&$name, $account) { // Display the user's uid instead of name. if ($account->id()) { $name = t('User @uid', ['@uid' => $account->id()]); } }