Jump to content

Manual:Hooks/UserAddGroup

From mediawiki.org
UserAddGroup
Available from version 1.18.0 (r84134, codereview)
Called when adding a group to an user.
Define function:
public static function onUserAddGroup( $user, &$group, &$expiry ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"UserAddGroup": "MediaWiki\\Extension\\MyExtension\\Hooks::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.


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
  • &$expiry: The expiry time in TS_MW format, or null if the group is not to expire; can be modified