Drupal is currently displaying the username inconsistently across some page titles. To allow the username to be displayed in a page title we must remove the link and other harmful things from it. Before we fix #464888: Use theme('username') in user profile page titles I think we should make theme_username() able to return the username without a link as pwolanin suggested in #229660: Use theme_username() in the personal contact form. To use filter_xss() everywhere to strip out the link seems like a hack in my eyes.

So, heres a patch that makes theme_username() able to return the name without a link. I have tested it, and I don't think this will break anything as it returns the username with a link by default as it is used to be.

CommentFileSizeAuthor
username_without_link.patch1.74 KBdixon_
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webchick’s picture

This seems pretty good but! How about a SimpleTest to ensure it's working as intended? :)

Heine’s picture

I don't think we should support changing usernames in theme_username. For instance, what about plaintext names for use in select #options or autocomplete fields? If we would want this consistently, we need a utility function that fetches the plaintext replacement name, then use theme(...) to theme that replacement as desired.

dixon_’s picture

Okey, I'll leave this for smart ass people to decide on ;)

JohnAlbin’s picture

Status: Needs review » Closed (duplicate)