Add UserGroupMembership details to the UserGroupsChanged hook
authorThis, that and the other <at.light@live.com.au>
Sat, 8 Apr 2017 07:32:53 +0000 (17:32 +1000)
committerThis, that and the other <at.light@live.com.au>
Sat, 8 Apr 2017 07:32:53 +0000 (17:32 +1000)
For Echo.

Bug: T159301
Change-Id: I5d32445f8e5b41599889b8488a2431e7a908f858

docs/hooks.txt
includes/specials/SpecialUserrights.php

index bee4477..af0eb06 100644 (file)
@@ -3589,6 +3589,10 @@ $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.
+$oldUGMs: An associative array (group name => UserGroupMembership object) of
+the user's group memberships before the change.
+$newUGMs: An associative array (group name => UserGroupMembership object) of
+the user's current group memberships.
 
 'UserIsBlockedFrom': Check if a user is blocked from a specific page (for
 specific block exemptions).
index b33aa7d..127b530 100644 (file)
@@ -387,7 +387,8 @@ class UserrightsPage extends SpecialPage {
                $user->invalidateCache();
 
                // update groups in external authentication database
-               Hooks::run( 'UserGroupsChanged', [ $user, $add, $remove, $this->getUser(), $reason ] );
+               Hooks::run( 'UserGroupsChanged', [ $user, $add, $remove, $this->getUser(),
+                       $reason, $oldUGMs, $newUGMs ] );
                MediaWiki\Auth\AuthManager::callLegacyAuthPlugin(
                        'updateExternalDBGroups', [ $user, $add, $remove ]
                );