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.
Comment | File | Size | Author |
---|---|---|---|
username_without_link.patch | 1.74 KB | dixon_ | |
Comments
Comment #1
webchickThis seems pretty good but! How about a SimpleTest to ensure it's working as intended? :)
Comment #2
Heine CreditAttribution: Heine commentedI 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.
Comment #3
dixon_Okey, I'll leave this for smart ass people to decide on ;)
Comment #4
JohnAlbinSee #192056: User's raw login name should not be output directly