seems to me that it would make sense for the checkbox to be checked by default when registration_role is going to assign a role to the user being created. Right now the checkbox is still blank, even in cases where the role does get assigned. So it's a bit confusing as a user.

Comments

WebSinPat’s picture

I was able to get the behavior I wanted (as described above) by totally hacking the module ;)

I changed the hook_form_FORM_ID_alter function to this (and was able to get rid of the _submit function altogether):

<?php
 function registration_role_form_user_register_form_alter(&$form, $form_state) {
   if ($rid = variable_get('registration_role_roles', '')) {
     $form['account']['roles'][$rid]['#default_value'] = TRUE;
     $form['account']['roles'][$rid]['#disabled'] = TRUE;
   }
}
?>

So I moved the role assignment to the user form creation rather than form submit.
Not sure if there's any disadvantage to my method or any reason not to do it this way, but it seems to work for what I want to do.

WebSinPat’s picture

Component: User interface » Code
mlncn’s picture

Thanks WebSinPat!

I'm not using this module currently, so i really should defer to you, but are your changes geared for the administrator adding new users? Does it still work for regular users self-registering? (If i recall correctly, they don't see any checkbox at all.)

mlncn’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)