And here it is.
1. Create a badge (with image).
2. Set this badge for 2 roles.
-> error message
user warning: Duplicate entry '2-11-role' for key 1 query: INSERT INTO user_badges_user (uid, bid, type) (SELECT uid, 2, 'role' FROM users_roles WHERE rid=13) in .../sites/all/modules/user_badges/user_badges.module on line 612.
-> info:
"There was a problem saving roles to the database"
--------
Possible solutions:
- "REPLACE INTO" (only on mysql, I know..), or
- "INSERT ... ON DUPLICATE KEY UPDATE" (cross-db compatible?), or
- check if the table rows already exist, and add only those that are missing yet, or
- wrap the stuff in a try/catch block, and just ignore the warnings.. (didn't think much about that, actually)
Comments
Comment #1
donquixote CreditAttribution: donquixote commentedThis works:
in user_badges_save_roles()
user_badges.module, line 610 ff.
Comment #2
NancyDruPlease try the latest and see if this is resolved. Let me know.
Comment #3
NancyDruI have committed a fix to 6.x-1.x-dev.
Comment #4
donquixote CreditAttribution: donquixote commentedSorry if I did not reply. The project is full of these little features, where we are just happy if they work, and then move on to other tasks. I think we still have the patched file as mentioned in #1, and so far it seems to work.
I might give more feedback if one day this moves back into our "locus of attention"..