The title may not be the best, so hopefully this is a good enough description. I encountered this with Role Watchdog, but I can imagine it being a problem with other modules that use hook_user().

Role Watchdog uses hook_user() to monitor changes to user roles, and logs the changes.

The program flow:

role_expire_cron() calls user_save(), which ends up firing Role Watchdog's hook_user(), but Role Watchdog isn't receiving the correct information in order to record the change.

It appears that this is because Role Watchdog is expecting these parameters to hook_user(), which in my observation is standard:

$account - the original user data.

$edit - the new values to save to the user.

However, role_expire_cron() is passing a modified user object, so Role Watchdog can't distinguish the "new" from the "old," and thus doesn't record the change.

This patch appears to solve it for me.

CommentFileSizeAuthor
#1 role_expire-707042-01.patch635 byteskentr

Comments

kentr’s picture

Issue tags: +cron
StatusFileSize
new635 bytes
kirie’s picture

Status: Needs review » Reviewed & tested by the community

I manually applied the patch to 6.x-1.9 and that did the trick for me. Note, though, that the 'User' cell in the Role History table shows empty - but that is a issue with Role Watchdog I assume?

stewsnooze’s picture

A manual edit of the patch just because I had added comments in to the code that stopped it applying quickly has been committed to CVS HEAD. It will be in the next release. THANKS!!!!

sharplesa’s picture

Version: 6.x-1.5 » 6.x-1.9
Assigned: kentr » sharplesa

Should be fixed by patch at http://drupal.org/node/1302440#comment-5100190 (which incorporate's kentr's work).

sharplesa’s picture

Status: Reviewed & tested by the community » Fixed

Addressed by role_expire 6.x-1.11, posted today (2011-10-30).

Status: Fixed » Closed (fixed)
Issue tags: -cron

Automatically closed -- issue fixed for 2 weeks with no activity.