Template:USERNAME/doc
- Description
- Adds the username of the registered user viewing the page into the page.
- Additionally, if specified, anonymous users will instead view preset content - demarcated by a pipe: {{USERNAME|<altcontent>}}
- Uses Javascript to replace contents in span with viewing username:
<span class="insertusername">Text_will_be_replaced_with_username</span>- Dependencies
- This template requires you to add the following to your MediaWiki:Common.js:
<syntaxhighlight lang="javascript"> if (wgUserName != 'null') { $('.insertusername').html(wgUserName); } </syntaxhighlight>
- Syntax
- Type
{{USERNAME}}somewhere. - Sample output
{{USERNAME}} is the best. [[Special:Mypage|{{USERNAME}}'s userpage is good too]].- gives...
is the best. 's userpage is good too.
- The user reading will always see a compliment directed toward them and their userpage, no matter who they are.