--- ucreate.module.orig 2009-01-12 19:34:47.000000000 -0500 +++ ucreate.module 2009-06-30 01:06:15.000000000 -0400 @@ -123,6 +123,14 @@ function ucreate_settings_form() { '#options' => $options, '#default_value' => variable_get('ucreate_default_roles', array()), ); + + $form['ucreate_excluded_roles'] = array( + '#title' => t('Excluded roles'), + '#description' => t('Roles a new user are NOT allowed to be assigned.'), + '#type' => 'checkboxes', + '#options' => $options, + '#default_value' => variable_get('ucreate_excluded_roles', array()), + ); // @todo: personalize e-mail message. return system_settings_form($form); } @@ -150,6 +158,16 @@ function ucreate_user_form() { $options = user_roles(); unset($options[1]); unset($options[2]); + + // remove excluded roles from options + $excluded_roles = variable_get('ucreate_excluded_roles', array()); + foreach ($excluded_roles as $key=>$val) { + if (!$val) { + unset($excluded_roles[$key]); + } + } + $options = array_diff_key($options, $excluded_roles); + $form['roles'] = array( '#title' => t('User roles'), '#type' => 'checkboxes',