Extension:UserFunctions/en

The UserFunctions extension provides a set of dynamic parser functions that trigger on the current user.

Usage
The following four functions are always available for use:
 * Tests whether the current user is anonymous.
 * Tests whether the current user is anonymous.


 * Tests whether the current user is blocked.
 * Tests whether the current user is blocked.


 * Tests whether the current user is a sysop.
 * Tests whether the current user is a sysop.


 * Tests whether the current user is a member of the group "group". You can check for multiple groups as well:
 * Tests whether the current user is a member of the group "group". You can check for multiple groups as well:

The following five personal data functions are disabled by default (see #Installation for how to enable them):


 * Returns the current user's real name. If the user is not logged in, this function returns the given alternate text, or the user IP if no alternate is provided.
 * Returns the current user's real name. If the user is not logged in, this function returns the given alternate text, or the user IP if no alternate is provided.


 * Returns the current username. If the user is not logged in, this function returns the given alternate text, or the user IP if no alternate is provided.
 * Returns the current username. If the user is not logged in, this function returns the given alternate text, or the user IP if no alternate is provided.


 * Returns the current user's email address. If the user is not logged in, this function returns the given alternate text, or the user IP if no alternate is provided.
 * Returns the current user's email address. If the user is not logged in, this function returns the given alternate text, or the user IP if no alternate is provided.


 * Returns the current user's nickname. If the user has no nickname, returns the username. If the user is not logged in, this function returns the given alternate text, or the user IP if no alternate is provided.
 * Returns the current user's nickname. If the user has no nickname, returns the username. If the user is not logged in, this function returns the given alternate text, or the user IP if no alternate is provided.


 * Returns the current user's IP address.
 * Returns the current user's IP address.

Allowing namespaces
By default, user functions only work in  namespace.

Below there are some examples of allowing or disallowing the functions to work in other namespaces. The syntax is based on the one used with subpages.

More info on namespace numbering.

In other contexts (recognized as NS -1, but not always a Special Page), such as in Page Forms pages, check you have the following parameter enabled:

The parameter above is enabled by default.

If you experience any problem with bots or maintenance scripts, turn it to false and report it to this talk page.

Version history
Authors: Algorithm and others
 * Version 2.8.1 (2022) Allow disabling/enabling specific personal data functions - Universal Omega


 * Version 2.8.0 (2021) Convert to ExtensionRegistry and other code cleanups - Universal Omega
 * Version 2.7.0 (2017) Removed PHP i18n shim - Kghbln
 * Version 2.6.1 (2014) Provided syntax changes - Kghbln, Umherirrender
 * Version 2.6.0 (2014) Composer-compatible extension - Toniher
 * Version 2.5.0 (2014) Migrated to JSON i18n - Siebrand
 * Version 2.4.3 (2014) Accumulated fixes and code cleaning - Chad Uckelman
 * Version 2.4.2 (2013) Some code cleaning - Reedy
 * Version 2.4.1 (2012) Fixed problems with Sidebar (report Kghbln). Cleared PHP warnings in functions - Toniher
 * Version 2.4 (2012) Cleaned using current ParserFunctions models. Fix when editing Semantic Forms - Toniher
 * Version 2.3 (2012) fixed problems when using scripts and allowed multiple groups to be checked against in ifingroup. - Toniher
 * Version 2.2 (2012) added $wgUFAllowedNamespaces parameter. Users need to define in which allowed NS functions will work. - Toniher
 * Version 2.1 (2011) added $wgUFEnablePersonalDataFunctions parameter. Migrated $wgUser to ParserOptions equivalent - Toniher
 * Version 2.0 (2011) added i18n and compatibility with other parser function extensions - Toniher
 * Version 1.5 (2011) added ip - Kghbln
 * Version 1.4 (2011) added realname - Kghbln
 * Version 1.3 (2010) added useremail - Wikinaut
 * Version 1.2 (2008) added ifingroup - Louperivois
 * Version 1.1 (2008) added nickname - Lexw
 * Version 1.0 (2006) Algorithm