Manual:Hooks/UsersPagerDoBatchLookups

From mediawiki.org
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onUsersPagerDoBatchLookups"
	}
}
Called from: File(s): specials/pagers/UsersPager.php
Function(s): doBatchLookup
Interface: UsersPagerDoBatchLookupsHook.php

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 (Wikimedia\Rdbms\IDatabase instance)
  • $userId: Array of user IDs whose groups we should look up
  • &$cache: Array of user IDs to internal user group name (e.g. 'sysop') mappings
  • &$groups: Array of group name to bool-true mappings for members of a given user group