[development] Improving theme('username') with inspiration from Facebook

Moshe Weitzman weitzman at tejasa.com
Mon Aug 20 14:28:06 UTC 2007


We have a handy function, theme('username') which accepts a uid and
name and returns a profile link. But perhaps that function should be a
bit more expressive. See below for the parameters to the equivalent
Facebook function (from
http://wiki.developers.facebook.com/index.php/Fb:name):

    * Required
          - int uid - The id of the user whose name to show.
    * Optional
          - bool firstnameonly - Show only the user's first name.
(default value is false)
          - bool linked - Link to the user's profile. (default value is true)
          - bool lastnameonly - Show only the user's last name.
(default value is false)
          - bool possessive - Make the user's name possessive (e.g.
Joe's instead of Joe). (default value is false)
          - bool reflexive - Use "yourself" if useyou is true.
(default value is false)
          - bool useyou - Use "you" if uid matches the logged in user.
Setting to false doesn't work if you use the "loggedinuser"
substitution for uid, since users can get freaked out by that.
(default value is true)
          - string ifcantsee - Alternate text to display if the logged
in user cannot access the user specified. (default value is [empty
string])
          - bool capitalize - Capitalize the text if useyou==true and
loggedinuser==uid. (default value is false)

Do folks think this is a good idea for Drupal core? If not, why? Could
we deal with 'possesive' and 'reflexive' flags in a way that respects
all languages? I know that this function can be enhanced in Contrib,
but my desire is to improve the core.


More information about the development mailing list