Please see the patch, I think it's self-explanatory.

Comments

neochief’s picture

StatusFileSize
new663 bytes

Status: Needs review » Needs work

The last submitted patch, admin-menu-format-username-1710570.patch, failed testing.

sun’s picture

Can you re-roll this patch against 3.x?

I also guess this change will require to add the #html => TRUE property to that link, since format_username() returns sanitized HTML already?

neochief’s picture

Status: Needs work » Needs review
StatusFileSize
new569 bytes

There you go

rosk0’s picture

Status: Needs review » Reviewed & tested by the community

Code is fine and works for me.

sun’s picture

I'm actually not sure whether I can see a bug here — the return value of format_username() is also not sanitized, so the #html = TRUE is actually wrong. ;)

The only actual difference and "bugs" I can see are:

1) "Anonymous" is not used for the anonymous user. (but are you showing admin_menu to anonymous users?)

2) hook_username_alter() is not invoked for the displayed username.

I can only guess that you're actually looking for 2.?

sun’s picture

Title: "Hello <username>" contains unformatted username » Use format_username() for "Hello <username>"
Category: bug » task
Status: Reviewed & tested by the community » Fixed

Well, OK, committed, but without the #html = TRUE property. :)

Thanks for reporting, reviewing, and testing! Committed to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.