User title callback should use getDisplayName instead of getUsername

Created on 11 January 2016, over 9 years ago
Updated 15 February 2024, about 1 year ago

As a developer, I expect hook_user_format_name_alter() to alter the name displayed in the page titles for users according to the docs for AccountInterface. However, that does not work as expected because the _title_callback in UserRouteProvider calls userTitle() on the UserController, which uses the deprecated getUsername() method to retrieve the name to display.

Changing the userTitle() method to call getDisplayName() results in no change to the default behavior of the title callback.

πŸ› Bug report
Status

Closed: duplicate

Version

8.5 ⚰️

Component
User systemΒ  β†’

Last updated 9 days ago

Created by

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024