Same as before. theme_username calls format_username which expects a fully-loaded not-half-ass user object.

Comments

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new16.47 KB

Status: Needs review » Needs work

The last submitted patch, 976114-theme-username-user-object-D7.patch, failed testing.

dave reid’s picture

Issue tags: +realname, +format_username
Anonymous’s picture

I'm wondering if this is still an issue. Where were the calls to theme_username that used a half-ass user object?

barraponto’s picture

@linclark probably from theme land :)

dave reid’s picture

Version: 7.x-dev » 8.x-dev

This still happens in core with format_username(). This still needs to solve the fact that comments can be anonymous, so we'd need to override the loaded $account object with properties from the comment entity before passing it into format_username().

xjm’s picture

andrewbelcher’s picture

I've rerolled against D8 and merged the patches from the two issues xjm has marked as duplicates of this... I'm expecting it to fail on anonymous comment names, as I'm not 100% sure which properties it needs, but hopefully it'll save someone else some time.

andrewbelcher’s picture

Status: Needs work » Needs review
StatusFileSize
new605 bytes

Here is another patch that we might want - requiring the argument to user_format_name() to be a User object. Currently it breaks everything due to the session user being a stdClass, so I doubt we want to apply it before that's fixed, but might be good to do once it is fixed.

Setting to needs review so that patches get tested, but I'm expecting them both to fail...

Status: Needs review » Needs work
Issue tags: -realname, -format_username

The last submitted patch, 976114_user_format_name-to-require-user-object_9.patch, failed testing.

mgifford’s picture

Assigned: dave reid » Unassigned
Issue summary: View changes
andypost’s picture

Version: 8.0.x-dev » 7.x-dev

8.x already fixed and format_username() accepts AccountInterface

andypost’s picture

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.