Closed (fixed)
Project:
Registration role
Version:
5.x-1.2
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2009 at 15:17 UTC
Updated:
30 Mar 2009 at 09:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
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 commentedstatus update
Comment #3
mlncn commentedThat hardcodes the role ID as role 1. Also has anyone tested this approach?
Comment #4
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 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 commentedYup, my bad– as noted, this was fixed in head a good while ago, and a new release has been made now.