Available from version 1.18.0 (r84134)
Called when adding a group to an user.
Define function:
public static function onUserAddGroup( $user, &$group ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"UserAddGroup": "MyExtensionHooks::onUserAddGroup"
Called from: File(s): User.php
Interface: UserAddGroupHook.php

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


Return false to override stock group addition.

  • $user: the user object that is to have a group added
  • &$group: the group to add, can be modified