Role cleared when user updates profile

tj2653 - April 27, 2008 - 20:54
Project:Role Control
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

I have role control provided only during registration. When a user in the role (provided during registration) updates their my account profile, and "maintain own role control" access ISN'T provided for them, they lose their role.

#1

elliot - April 28, 2008 - 12:30

Hmm, I hadn't originally planned for people being able to add a role during registration (I believe there are other modules that do this) and had made the obviously false assumption that if you allow someone to add a role during registration that they should have the power to maintain that role. If someone would like to figure out a fix for this I'd be more than happy to review it. I'm swamped with other work at the moment, but will look at it when I get a chance.

#2

smokris - December 18, 2008 - 19:34
Status:active» needs review

On a site I'm running, I give users the ability to set a role during registration *and* when updating their account settings.

If the user edits the main account settings --- "/user/x/edit" --- and saves, the selected role is properly preserved.

If the user edits their profile.module profile --- "/user/x/edit/profile" --- and saves, the role_control checkbox is preserved, but the actual role is cleared.

I've attached a patch which solves this problem on my site --- if the role_control checkbox doesn't appear on the submitted form, it takes no action; if it does, it either adds or removes the role as usual.

AttachmentSize
role_control_profile_fix.patch 971 bytes

#3

elliot - December 24, 2008 - 16:14
Version:5.x-1.0» 5.x-1.x-dev

Thanks, I'm integrating this fix into 5.x-1.x-dev now.
-Elliot

 
 

Drupal is a registered trademark of Dries Buytaert.