Closed (fixed)
Project:
Registration codes
Version:
7.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2015 at 18:59 UTC
Updated:
29 Jun 2015 at 23:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ayesh commentedYou are right these DB queries need to be replaced with user_multiple_role_edit(). Should be an easy patch.
There were many API incompatibilities in the 7.x-1.0 so I'm planning a rewrite as soon as I have some time.
But this surely is a big and can't wait for the 7.x-2.0.
Comment #2
davemaxg commentedThanks Ayesh for responding so quickly and for all your hard work on this module!
I did some looking into this function and I think another approach may make more sense because if a regcode has multiple rules, there may be a need to assign multiple roles to a user. Saving after adding each role is some unnecessary overhead. This function is best suited for adding one role to multiple users. I did implement it as a patch in case anyone needs it, but it's not the best solution IMO.
David
Comment #5
ayesh commentedThanks Dave.
Your patch was unfortunately based to the Drupal root. It however does the job, so I went ahead and committed to the current head.
The 6.x-2.x branch did not need any changes because it added the roles to user object directly before saving. This will come with the 7.x-1.4 release. Thanks a lot Dave.
Comment #6
ayesh commentedComment #8
davemaxg commentedThis line is preventing the role assignment in user_multiple_role_edit from working
$account->roles[$rule['role_id']] = $rule['role'];
Just remove it and everything is working again.
Thank you Ayesh!