Manual:Hooks/UsersPagerDoBatchLookups

From MediaWiki.org
Jump to navigation Jump to search
UsersPagerDoBatchLookups
Available from version 1.28.0 (Gerrit change 306434)
Give extensions providing user group data from an alternate source a chance to add their data into the cache array so that things like global user groups are displayed correctly in Special:ListUsers.
Define function:
public static function onUsersPagerDoBatchLookups( \Wikimedia\Rdbms\IDatabase $dbr, array $userIds, array &$cache, array &$groups ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UsersPagerDoBatchLookups": "MyExtensionHooks::onUsersPagerDoBatchLookups"
	}
}

For MediaWiki ≤1.25:

$wgHooks['UsersPagerDoBatchLookups'][] = 'MyExtensionHooks::onUsersPagerDoBatchLookups';
Called from:File(s): UsersPager.php
Function(s): doBatchLookup

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

Details[edit]

  • $dbr - Read-only database handle
  • $userIds - Array of user IDs whose groups we should look up
  • &$cache - Array of user ID -> internal user group name (e.g. 'sysop') mappings
  • &$groups - Array of group name -> bool true mappings for members of a given user group