FANDOM


<insert name here>

Template documentation (for the above template, sometimes hidden or invisible)[view] [edit] [history] [refresh]
Description
Adds the username of the registered Wikia user who is viewing the page. If no user is logged in, the supplied alt text is displayed instead.
Syntax
{{USERNAME|<alt text>}}
Optional alt text is what is displayed when no user is logged in. If nothing is supplied as alt text, users will see "<insert name here>" when not logged in.
Examples
{{USERNAME}} is the best.
Gives…
<insert name here> is the best.
If not logged in, you see…
<insert name here> is the best.
[[Special:Mypage|{{USERNAME|Visitor}}'s userpage is good too]].
Gives…
Visitor's userpage is good too.
If not logged in, you see…
Visitor's userpage is good too.
Dependencies
This template requires you to add the following to your wiki's MediaWiki:Common.js.
/*
    Replaces {{USERNAME}} with the name of the user browsing the page.
    Requires copying Template:USERNAME.
*/
 
$(function() {
    if (window.disableUsernameReplace || mw.config.get('wgUserName') === null) { return; }
    $('span.insertusername').html(mw.config.get('wgUserName'));
});
The above text is transcluded from Template:USERNAME/doc; you can change it or view its history. (How does this work?)
If you're done making changes, please refresh the text. (Why?)
You can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Please add categories and interwikis to Template:USERNAME/doc. (View all subpages of this page.)
Community content is available under CC-BY-SA unless otherwise noted.