Manual:Hooks/UserEffectiveGroups
UserEffectiveGroups | |
---|---|
Available from version 1.11.0 Dynamically add or remove to the default user groups provided by the database table User groups table | |
Define function: | public static function onUserEffectiveGroups( &$user, &$aUserGroups ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"UserEffectiveGroups": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserEffectiveGroups"
}
}
|
Called from: | File(s): User.php |
Interface: | UserEffectiveGroupsHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:UserEffectiveGroups extensions.
Use cases
editThe UserEffectiveGroups
hook lets MediaWiki installations filter and add to the list of user groups stored in the MediaWiki database. For example, one might wish to synchronize the user groups with the host operating system or with a third party package.
Usage
editAt the time of invocation $aUserGroups
is populated with the groups assigned to the user by the User groups table. Functions attached to this hook change the groups by adding or removing array elements.