Manual:Hooks/UserrightsChangeableGroups

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.