This feature request is to document something that is being done on for our specific use case. Please tell us if we are doing something egregiously wrong. If it makes sense, you may consider incorporating this patch in future versions of role_watchdog too.
diff --git a/htdocs/sites/all/modules/role_watchdog/role_watchdog.module b/htdo$
index b68e163..63a04be 100644
--- a/htdocs/sites/all/modules/role_watchdog/role_watchdog.module
+++ b/htdocs/sites/all/modules/role_watchdog/role_watchdog.module
@@ -66,11 +66,9 @@ function role_watchdog_user($type, &$edit, &$account, $categ$
switch ($type) {
case 'update':
global $user;
- if ($user->uid != $account->uid) {
if (isset($edit['roles'])) {
role_watchdog_user_save((isset($account->uid) ? $account->uid : FALS$
}
- }
break;
case 'delete':
As can be seen in the code snippet above the role change is only logged if the account whose role is being changed is different from the user initiating it. This restriction seems limiting to us (and unecessary). We have removed that restriction as you can see.
Our specific use case is that users may change certain things about their account (e.g. they may select that the account be upgraded/downgraded to a different kind account) that may require the addition or subtraction of certain roles (via code that runs on their behalf). If we use the code from role watchdog 1.2 then these role changes are not recorded. By making the above small patch... such role changes are recorded.
The authors of this module may wish to expose this as a switch "Record own role changes" or incorporate the patch totally.
Suggestions are requested.
Comments
Comment #1
greg.1.anderson commentedDuplicate of #1517028: Log role changes that users make to their own account.
Comment #1.0
greg.1.anderson commentedminor grammar change