Manual:Hooks/UserGetImplicitGroups

UserGetImplicitGroups
Available from version 1.11.0
Removed in version 1.32.0 (Gerrit change 465784)
Dynamically adds to or removes from the list of available groups.
Define function:
public static function onUserGetImplicitGroups( &$aGroups ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"UserGetImplicitGroups": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserGetImplicitGroups"
	}
}
Called from: File(s): User.php
Interface: UserGetImplicitGroupsHook.php

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


Use cases

edit

This hook may be used as part of an extension that synchronizes the list of available groups with external applications or the host operating system.

Implementation background

edit

MediaWiki supports the assignment of group-based user rights. The list of available groups is defined by three sources: groups hard coded into MediaWiki (*, user, autoconfirmed, emailconfirmed), the keys of the $wgGroupPermissions configuration variable and the groups added or filtered by this hook.

Usage

edit

Implementers return a list of groups that should be added. The source for the list may be a hard coded list, a file, a database table, a third party application, or anything else a programmer's imagination can dream up.