Manual:Hooks/UserrightsChangeableGroups

From MediaWiki.org
Jump to: navigation, search
UserrightsChangeableGroups
Available from version 1.14.0
Removed in version 1.16.0
Called after the list of groups that can be manipulated via Special:UserRights is populated, but before it is returned.

*Define function:
function fnMyHook( $userrights, $user, $addergroups, &$groups ) { ... }

*Attach hook:
$wgHooks['UserrightsChangeableGroups'][] = 'MyExtensionHooks::someExample';
Called from: SpecialUserrights.php

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


[edit] Details

  • $userrights: The UserrightsForm object.
  • $user: The user object of the current user.
  • $addergroups: Array of groups that the user is in.
  • $groups: Array of groups that are changeable by this interface. Change this variable to modify that list.
    • $groups is in the format of array( 'add' => array( addablegroups ), 'remove' => array( removeablegroups ), 'add-self' => array( groups addable to self), 'remove-self' => array( groups removable from self ) ).

This hook allows extensions to change what groups a user may add or remove from other users or themselves, independent from user rights or configuration variables. A possible use could be to prevent users that are not in a certain group but have full userrights access from adding or removing that specific group.

Only the $groups variable is passed by reference, so modification of other aspects of the Userrights form or the current user cannot be achieved with this hook.

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox