User:Wlgrin/Template/GetUserNameFromUserPageName/doc

Template extracts the name of the user from the name of a user page passed as a parameter.

Basic usage
Template takes a single, unnamed parameter   : the full name of a page in user space.

Currently, user space includes two namespaces:
 * which, in this version of Wikipedia, evaluates to “   ” and is used for ordinary user pages.
 * which, in this version of Wikipedia, evaluates to “   ” and is used for user discussion pages.

Template uses template  to verify that the full page name supplied is really from user space. In the affirmative, it then extracts and returns the name of the user associated to that page. Otherwise, it produces nothing.

If no parameter is passed, template uses the name of the current page.


 * {| class="wikitable collapsible collapsed" style="min-width:30em;"

!style="text-align:left;"|Examples
 * style="padding:1em;"| For example, using the following call on page “   :MeMysefEtMoi/Archive/2011”:
 * style="padding:1em;"| For example, using the following call on page “   :MeMysefEtMoi/Archive/2011”:

will produce
 *  MeMysefEtMoi

In this particular case, the same result would have been obtained by calling without parameter:


 * }

Using substitution
Template can be safely substituted, since it uses the “safesubst” modifier to call parser functions, magic words and other templates, and only calls templates that can also be safely substituted.

If you wish to substitute template instead of transcluding it, remember to also substitute any parser functions or magic words used in its parameter list. This is because the MediaWiki parser performs all substitutions before performing any transclusion.


 * {| class="wikitable collapsible collapsed" style="min-width:30em;"

!style="text-align:left;"|Examples
 * style="padding:1em;"| For example, using the following incorrect call on page “   :MeMysefEtMoi/Archive/2011”:
 * style="padding:1em;"| For example, using the following incorrect call on page “   :MeMysefEtMoi/Archive/2011”:

will produce the likely unintended output
 *  “”

because will be substituted before  is resolved. By contrast,

will produce, as expected,
 * <samp style="padding-left:1em; padding-right:1em; background-color:#F2FFE6;"> “MeMysefEtMoi”


 * }