From: Stephane Bisson Date: Mon, 8 Feb 2016 22:06:33 +0000 (-0500) Subject: Add 'reason' to UserGroupsChanged hook X-Git-Tag: 1.31.0-rc.0~7948^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=c762e0ced90472fcd013a415eedb6337c7ded025;p=lhc%2Fweb%2Fwiklou.git Add 'reason' to UserGroupsChanged hook Used by Echo to display the reason in the 'user-rights' notifications Bug: T126277 Change-Id: Ib9bb28a7a77602e3e729fd0bf13ab8259e15b006 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 0fe888fe7e..038df91728 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -3285,6 +3285,8 @@ $user: User whose groups changed $added: Groups added $removed: Groups removed $performer: User who performed the change, false if via autopromotion +$reason: The reason, if any, given by the user performing the change, +false if via autopromotion. 'UserIsBlockedFrom': Check if a user is blocked from a specific page (for specific block exemptions). diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 7351c33022..205b67ed8c 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -292,7 +292,7 @@ class UserrightsPage extends SpecialPage { $user->invalidateCache(); // update groups in external authentication database - Hooks::run( 'UserGroupsChanged', array( $user, $add, $remove, $this->getUser() ) ); + Hooks::run( 'UserGroupsChanged', array( $user, $add, $remove, $this->getUser(), $reason ) ); $wgAuth->updateExternalDBGroups( $user, $add, $remove ); wfDebug( 'oldGroups: ' . print_r( $oldGroups, true ) . "\n" ); diff --git a/includes/user/User.php b/includes/user/User.php index 749ec46840..95e5ceb98d 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1387,7 +1387,7 @@ class User implements IDBAccessObject { $this->addGroup( $group ); } // update groups in external authentication database - Hooks::run( 'UserGroupsChanged', array( $this, $toPromote, array(), false ) ); + Hooks::run( 'UserGroupsChanged', array( $this, $toPromote, array(), false, false ) ); $wgAuth->updateExternalDBGroups( $this, $toPromote ); $newGroups = array_merge( $oldGroups, $toPromote ); // all groups