This Forum has been archived

Visit the new Forums
Forums: Index Support Requests How to use Template: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 2204 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

Everytime I use this template on my wiki, it only displays "<insert name here>". I want to know how to change the "<insert name here>" into this. Thanks. The Fan of Wiki 05:53, June 7, 2012 (UTC)

You should be able to just type <insert name here>
without needing a template, however it does show <insert name here> if you're not logged in. That said, this might work: </s>
<{{USERNAME}} is the best. [[Special:Mypage|{{USERNAME}}'s userpage is good too]].
Try that in the template and see what happens. ђ tคlк 05:57, June 7, 2012 (UTC)</s>
My mistake, I was under the assumption that <insert name here>
is a MediaWiki keyword. To make it work add this to the MediaWiki:Common.js file on your wiki:
/* Username replace feature
 * Inserts viewing user's name into <span class="insertusername"></span>
 * Put text inside the spans to be viewed by logged out users
 * Originally by [[wikia:User:Splarka|Splarka]], then by [[User:Spang|Spang]],
 * This (jQuery) version by [[wikia:User:Joeyaa]], written to be backwards compatible
if (wgUserName != 'null') {
ђ tคlк 06:00, June 7, 2012 (UTC)
(edit conflict)
Wogan is correct. It requires javascript to do. The JS adds the user's name in place of the default text. You can change his further to add something for anons too (IE, "anonymous user" instead of "Insert name here").
Edit: Ahh, that code takes into consideration for anons. Just add <span class="insertusername">anonymous user</span> to do that. Rappy 06:03, June 7, 2012 (UTC)

For Registered Users

How about registered users' usernames? Sorry if I don't mentioned this earlier. The Fan of Wiki 07:08, June 7, 2012 (UTC)

The javascript is for registered users. What's there by default is for anonymous users. Rappy 21:06, June 7, 2012 (UTC)

Okay, Thanks for the help. I figured it out. :) The Fan of Wiki 01:48, June 8, 2012 (UTC)