$ip: IP of the user who sent the message out
$u: the account whose new password will be set
+'UserAddGroup': called when adding a group; return false to override
+stock group addition.
+$user: the user object that is to have a group added
+$group: the group to add
+
'UserArrayFromResult': called when creating an UserArray object from a
database result
&$userArray: set this to an object to override the default object returned
$inject_html: Any HTML to inject after the "logged out" message.
$oldName: name of the user before logout (string)
+'UserRemoveGroup': called when removing a group; return false to override
+stock group removal.
+$user: the user object that is to have a group removed
+$group: the group to be removed
+
'UserRights': After a user's group memberships are changed
$user : User object that was changed
$add : Array of strings corresponding to groups added
* @param $group String Name of the group to add
*/
function addGroup( $group ) {
- $dbw = wfGetDB( DB_MASTER );
- if( $this->getId() ) {
- $dbw->insert( 'user_groups',
- array(
- 'ug_user' => $this->getID(),
- 'ug_group' => $group,
- ),
- __METHOD__,
- array( 'IGNORE' ) );
+ if( wfRunHooks( 'UserAddGroup', array( &$this, &$group ) ) ) {
+ $dbw = wfGetDB( DB_MASTER );
+ if( $this->getId() ) {
+ $dbw->insert( 'user_groups',
+ array(
+ 'ug_user' => $this->getID(),
+ 'ug_group' => $group,
+ ),
+ __METHOD__,
+ array( 'IGNORE' ) );
+ }
}
-
$this->loadGroups();
$this->mGroups[] = $group;
$this->mRights = User::getGroupPermissions( $this->getEffectiveGroups( true ) );
*/
function removeGroup( $group ) {
$this->load();
- $dbw = wfGetDB( DB_MASTER );
- $dbw->delete( 'user_groups',
- array(
- 'ug_user' => $this->getID(),
- 'ug_group' => $group,
- ), __METHOD__ );
-
+ if( wfRunHooks( 'UserRemoveGroup', array( &$this, &$group ) ) ) {
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->delete( 'user_groups',
+ array(
+ 'ug_user' => $this->getID(),
+ 'ug_group' => $group,
+ ), __METHOD__ );
+ }
$this->loadGroups();
$this->mGroups = array_diff( $this->mGroups, array( $group ) );
$this->mRights = User::getGroupPermissions( $this->getEffectiveGroups( true ) );