Can users change their own role?

everydayjones - January 18, 2009 - 22:28
Project:Auto Assign Role
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

If a user signs up and doesn't select a role, can they go back into their account and select the role? I don't see that option in the users Account settings.

#1

gr4phic3r - February 18, 2009 - 12:50

i would need this too ... i think this could be very usefull.
can you add a checkbox in the module where you can activate if users can change their roles or not? that would be great!
i would need it for D6

greets

#2

gr4phic3r - March 1, 2009 - 22:50

i found a solution for that if someone is interested in it ... for D6

greets

#3

billnbell - March 4, 2009 - 08:03

Post it

#4

ElGranAzul - March 9, 2009 - 19:16
Version:5.x-1.2» 6.x-1.x-dev

Yes, I'm also looking for it. Please, post.

#5

gr4phic3r - March 18, 2009 - 12:28

hi

just delete or comment out the lines marked with "modified by gr4phic3r" in autoassignrole.module

/**
* Implementation of hook_user().
*/
function autoassignrole_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'insert':
case 'update':
/* modified by gr4phic3r
      if (_autoassignrole_settings('user_active') == 1) {
*/
        $roles = array();
        $user_roles = _autoassignrole_settings('user_roles');
        if(is_array($edit['user_roles'])) {
          foreach ($edit['user_roles'] as $k => $v) {
            if ($v != 0 && in_array($k, $user_roles)) {
              $roles[$k] = $v;
            }
          }
          $edit['roles'] = $roles;
        }
/* modified by gr4phic3r
        elseif($edit['user_roles'] != '') {
          $edit['roles'] = array($edit['user_roles'] => $edit['user_roles']);
        }
      }
*/
      if (_autoassignrole_settings('auto_active') == 1) {
        $auto_roles = _autoassignrole_settings('auto_roles');
        foreach($auto_roles as $k => $v) {
          $edit['roles'][$k] = $v;
        }
      }
      $account = user_load(array("uid"=>$account->uid));
    break;

greets

#6

ElGranAzul - March 19, 2009 - 17:37
Category:support request» feature request
Status:active» patch (to be ported)

A lot of thanks... I've marked it as a patch to see if it can be done in next version.

#7

cyberswat - April 1, 2009 - 20:49
Status:patch (to be ported)» needs work

Please roll this as a real patch http://drupal.org/patch/create

#8

manoloka - April 18, 2009 - 19:26

Wouldn't be easier just mark it as "Required" than patching the module?

This way if someone submits without choosing a role they'll get a "field is required" message.

Just my thoughts

#9

gmclelland - May 21, 2009 - 18:54

What is the status on this?

This should definitely be an option included, but maybe it should use the variables that is under the "Allow user to choose" fieldset on the AutomaticAssignRoles settings page.

#10

cyberswat - June 13, 2009 - 03:57

Still looking for a decent patch for this.

#11

billnbell - June 15, 2009 - 06:43

It appears this is in the beta 3...

I think the "case 'update':" is missing too.

#12

Junro - August 10, 2009 - 22:40

subscribe,

Do this pach is in the last dev version of July? I can't find how to allow users to change their roles.

#13

cyberswat - August 18, 2009 - 23:47
Status:needs work» won't fix

This would only work if the user is allowed to make the selection during registration. It looses viability when a user is presented with multiple paths or content types that can function as a registration form. Each path might present a node with specific cck fields that are required. Simply providing a mechanism for the user to switch their role would not account for all of the possible variations. I'm not entirely convinced this is something I am going to be able to provide.

I am going to mark this as won't fix unless a decent patch is provided that can be prooven through simpletest

#14

Junro - August 19, 2009 - 08:15

@cyberswat

"This would only work if the user is allowed to make the selection during registration." It's what I need! :)

#15

Junro - October 6, 2009 - 10:33
Status:won't fix» active

Hello, Users can choose a role on registration page but can't change their role after... It doesn't make sense.

My users HAVE to choose a role (only one) on registration page but they could change it later...

This feature is impossible?

#16

eosrei - October 31, 2009 - 00:33
Status:active» won't fix

@juno it's not impossible. I'm sure cyberswat would accept a patch for this functionality.

Have you looked at http://drupal.org/project/role_control?

Setting back to won't fix since cyberswat's reasoning still applies.

#17

Junro - October 31, 2009 - 09:47

@control

I didn't take a look on this module. i would say: Again a module not maintained...
I'm not a developper it's not safe for me to use it....
The problem with Drupal is that a lot of modules have to be maintain to avoid problems.

#18

eosrei - November 25, 2009 - 02:01

It's not unsafe per se. Unless there are outstanding security bugs listed, it is just a matter of it working correctly. Try it and test everything. If it works correctly for your needs, then there isn't an important reason you can't use it.

#19

izahn - December 4, 2009 - 02:53

I really want this functionality. With the current system a user has only one shot to choose the appropriate role. If they screw up and choose the wrong one their stuck with it unless they contact the admin and request a change. I really want users to be able to change their role after the fact. Maybe I'm doing something wrong, but commenting out parts of the code as suggested n #5 did not seem to achieve this.

I don't have the chops to program this myself, but I'm willing to contribute $50 USD towards seeing this implemented.

-Ista

 
 

Drupal is a registered trademark of Dries Buytaert.