Download & Extend

Make it possible to override registration_role when user is created by an admin

Project:Registration role
Version:5.x-1.3
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

As a side effect of #362067: Conflict with Login Tobaggon the roles of a user created by an administrator will now always contain the RR assigned role. The prior method gave full control to the admin/user/user/create form so users created by an admin had exactly the roles selected on the admin form. I have 2 potential patches:

first, http://drupal.org/files/registration_role-ignore_admin.patch
Adds a checkbox to the RR configuration that allows the admin to ignore the addition of a RR specified role when a user is added via the admin user_register form.

second, http://drupal.org/files/registration_role-admin_default.patch
From a UI perspective the first idea didn't make sense after I had already built it, so I came up with this. Grab the RR role and check the box for that role on the admin user_register form by default and always ignore the RR role from the admin user_register form.

AttachmentSize
registration_role-ignore_admin.patch1.78 KB
registration_role-admin_default.patch985 bytes

Comments

#1

new version of the admin_default method, the first one has a flaw in the logic due to operation order

AttachmentSize
registration_role-admin_default.patch 988 bytes

#2

Status:needs review» needs work

Wow i have been a horrible maintainer. I wish these issues would have shown up in http://drupal.org/project/issues/user (without my leaving a comment like this) and maybe this wouldn't have gone 2 years without my noticing.

The patch looks like it would replace existing default values when an administrator edits a user page. An array_merge() here?

+    $form['account']['roles']['#default_value'] = array(variable_get('registration_role_roles', ''));