Manual:Hooks/ChangeUserGroups

From MediaWiki.org
Jump to navigation Jump to search
ChangeUserGroups
Available from version 1.29.0 (Gerrit change 329727)
Called before a user's group memberships are changed
Define function:
public static function onChangeUserGroups( $performer, $user, &$add, &$remove ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ChangeUserGroups": "MyExtensionHooks::onChangeUserGroups"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ChangeUserGroups'][] = 'MyExtensionHooks::onChangeUserGroups';
Called from:File(s): specials/SpecialUserrights.php

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

Details[edit]

This occurs before a user's group memberships are changed.

  • $performer: The User who will perform the change
  • $user: The User whose groups will be changed
  • &$add: The groups that will be added
  • &$remove: The groups that will be removed

See also[edit]