Manual:Hooks/UserAddGroup

From MediaWiki.org
Jump to navigation Jump to search
UserAddGroup
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"
	}
}

For MediaWiki ≤1.25:

$wgHooks['UserAddGroup'][] = 'MyExtensionHooks::onUserAddGroup';
Called from:File(s): User.php

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

Details[edit]

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