Manual:Hooks/APIQueryUsersTokens

Category:MediaWiki hooks#APIQueryUsersTokens Category:Hooks added in MediaWiki 1.15.0#APIQueryUsersTokens Category:MediaWiki deprecated or obsolete features#APIQueryUsersTokens Category:Hooks removed in MediaWiki 1.36.0#APIQueryUsersTokens Category:Hooks deprecated in MediaWiki 1.24.0#APIQueryUsersTokens
APIQueryUsersTokens
Available from version 1.15.0
Removed in version 1.36.0 (Gerrit change 625758)Category:Removed hooks#APIQueryUsersTokens
Use this hook to add custom token to list=users.
Define function:
public static function onAPIQueryUsersTokens( &$tokenFunctions ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"APIQueryUsersTokens": "MediaWiki\\Extension\\MyExtension\\Hooks::onAPIQueryUsersTokens"
	}
}
Called from: File(s): api/ApiQueryUsers.phpCategory:MediaWiki hooks included in ApiQueryUsers.php#APIQueryUsersTokens
Interface: APIQueryUsersTokensHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:APIQueryUsersTokens extensions.

Details

  • $tokenFunctions: array(action => callback)

Notes

Every token has an action, which will be used in the ustoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or false if the user isn't allowed to obtain it.

The prototype of the callback function is func($user) where $user is the User object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense)

Category:Hooks added in MediaWiki 1.15.0 Category:Hooks deprecated in MediaWiki 1.24.0 Category:Hooks removed in MediaWiki 1.36.0 Category:MediaWiki deprecated or obsolete features Category:MediaWiki hooks Category:MediaWiki hooks included in ApiQueryUsers.php Category:Removed hooks