I have just created a bug report with user_badge module (In http://drupal.org/node/161822 ) with the following description:
Userpoints module has been integrated with user_badges module and can automatically promote users to new roles upon their gaining certain thresholds set in userpoints' settings. This tandem of two modules would be just perfect if not a problem with showing new badges for the users promoted to new roles. It does not show until you go to such a user's account page 1) uncheck new role (demote user from a new role), 2) save, 3) go into account editing page again and manually check new role again and save. I guess saving the user's account trigers something, some kind of record to database, which was missed by userpoints' module when it was promoting the user to a new role. I am not sure which exact module between the two this problem belongs to. So I am creating this issue for both modules.
I tend to think this is more of user_badge module's problem. Nevertheless, I think that userpoints_role module could really take care for solving this issue, since it is responsible for saving settings in database for a promoted user's new role. I believe the issue would be solved if userpoints_role would follow the following logic when saving new settings for the user:
1) to check if user_badges module is installed;
2) if it is not, then go usual way and save new settings for the user just for userpoints_role part. or else
3) if it is, then to save changes for the user_badges database tables too.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | userpoints_role.022508.patch | 774 bytes | ebeyrent |
Comments
Comment #1
yngens commentedCould User Point Module Maintainers invoke user_hooks, so that other modules can respond to the role change, as was suggested by Heine here: http://drupal.org/node/161822
Comment #2
jredding commentedComment #3
ebeyrent commentedI have the same problem, and here's what I found:
userpoints_role used to call user_multiple_role_edit() in the function _userpoints_role_join(). user_multiple_role_edit() calls user_save() to update the user. UserBadges implements hook_user, which updates the user/badge association on the update operation.
The latest version of userpoints_role does not do this. It directly inserts data into the database instead of calling the user_multiple_role_edit() function.
User_badges is working just fine as is - the problem lies with the userpoints_role module.
We need to patch userpoints_role one way or the other; either insert directly into the database to udpate the badge, or implement hook_user.
Comment #4
ebeyrent commentedThe fix is really quite simple - see attached patch.
Comment #5
ebeyrent commentedI should note that my patch is applied to version 5.x-3.3 of userpoints - there was an exact same patch applied to the 5.x-2.9 version of userpoints_role that was somehow left out of the latest 5.3 branch.
Comment #6
kbahey commentedFixed in 3.x-dev.
Thank you.
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #8
venusrising commentedIs there a patch available for D6?
Thanks
Comment #9
venusrising commented