This Forum has been archived

Visit the new Forums
Forums: Index Support Requests Display the current user's username?
Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.

50px-Replacement filing cabinet.svg

Note: This topic has been unedited for 1979 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

Is there any code to render a current user's username (ex. for me it would say iggyvolz)? I want to implement this code, perhaps, in a situation where it would display the edit links only for admins. If this can only be done by JS or CSS, I'm okay with that. Iggyvolz 18:11, May 13, 2012 (UTC)

You might find the information in this forum topic helpful: Forum:User rights check for displaying content. --Gardimuer { ʈalk } 15:17, May 14, 2012 (UTC)
Thanks, this is perfect. Iggyvolz 20:07, May 18, 2012 (UTC)
Did I do something wrong? w:c:trackersinterface:Template:Username Iggyvolz 20:37, May 18, 2012 (UTC)

Sorry, Monchoman45's code in the link above is for conditionally displaying content depending upon whether the viewer is an admin, bureaucrat, etc. which is what you said you needed. In your template it looks like you just want to display the viewer's name.

One problem with your template was that the use of "=" in the default line confused the #switch parser function. I corrected that here. The second problem is that using html in an #ifeq function will always result in a value of "not equal". See MW:Help:Extension:ParserFunctions#.23ifeq for more about that. --Gardimuer { ʈalk } 21:43, May 18, 2012 (UTC)