Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It seems that Login Toboggan, when assigning a TEMPORARY role, overwrites RR role assignment. Then when the user clicks on the link in the confirmation email, it resets their status to Authenticated User, without the role assigned through RR being maintained or restored.
A previous issue mistakenly set this as 'by design', when it in fact is a conflict between the two modules.
Comment | File | Size | Author |
---|---|---|---|
#1 | registration_role-issue362067.patch | 431 bytes | tbartels |
Comments
Comment #1
tbartels CreditAttribution: tbartels commentedIt's actually not a conflict with Logintoboggan specifically, it is a conflict with user_save and the regsitration_role module not properly setting a new role.
user_save(http://api.drupal.org/api/function/user_save/5) calls the insert hook expecting modules that want to alter a user insert to use the $edit array to set new variables, after the hook is called is when the roles are updated, and if there exists any new roles in the $edit array, all old roles are dropped, and since registration_role is using a direct SQL statement to alter the users roles the user_save is pretty much immediately deleting that change. Any module that alters user roles will break registration_role.
Attached is a fix to use the $edit array to properly set the role at registration.
Comment #2
tbartels CreditAttribution: tbartels commentedstatus update
Comment #3
mlncn CreditAttribution: mlncn commentedThat hardcodes the role ID as role 1. Also has anyone tested this approach?
Comment #4
mlncn CreditAttribution: mlncn commentedThanks to a patch supplied by abhaga and christefano in issue http://drupal.org/node/320087 this was in fact fixed long ago, but i failed to create a release. New release now, 5.x-1.3. My apologies.
benjamin, Agaric Design Collective
Comment #5
tbartels CreditAttribution: tbartels commented> That hardcodes the role ID as role 1. Also has anyone tested this approach?
No, the "1" is a truth(boolean) value, not an RID, print_r() a user object and look at the format of the roles array. The value of [$rid] makes no difference, I put up the link to the api documetation for reference, all that matters is that the $user[roles] array exists and has a list of keys that represent the RIDs you want to add/modify.
The other patch does the job just fine except for instantiating an empty array for no reason, but I don't see a use-case where the difference would be noticeable.
Comment #6
mlncn CreditAttribution: mlncn commentedYup, my bad– as noted, this was fixed in head a good while ago, and a new release has been made now.