commit d75d1835661555dcebd9ec0aced7b4d7f2e68e14 Author: skaught Date: Fri Feb 3 12:45:00 2012 -0500 fixed translation strings. minor logic repair. diff --git a/autoassignrole.admin.inc b/autoassignrole.admin.inc index 330ba83..2a72235 100644 --- a/autoassignrole.admin.inc +++ b/autoassignrole.admin.inc @@ -149,7 +149,7 @@ function autoassignrole_user_settings() { '#type' => 'textarea', '#title' => t('User Role Description'), '#description' => t('The description displayed to the end user when they are selecting their role during registration.'), - '#default_value' => variable_get('autoassignrole_user_description', t('Select a role')), + '#default_value' => t('Select a role'), '#required' => FALSE, ); @@ -157,7 +157,7 @@ function autoassignrole_user_settings() { '#type' => 'textfield', '#title' => t('User Role Fieldset Title'), '#description' => t('The title of the fieldset that contains role options.'), - '#default_value' => variable_get('autoassignrole_user_fieldset_title', t('User Roles')), + '#default_value' => t('User Roles'), '#size' => 60, '#maxlength' => 128 ); @@ -166,7 +166,7 @@ function autoassignrole_user_settings() { '#type' => 'textfield', '#title' => t('User Role Title'), '#description' => t('The title of the field that contains the role options the end user sees during registration.'), - '#default_value' => variable_get('autoassignrole_user_title', t('Role')), + '#default_value' => t('Role'), '#size' => 60, '#maxlength' => 128, '#required' => FALSE, diff --git a/autoassignrole.module b/autoassignrole.module index 30c43e4..b8d91d8 100644 --- a/autoassignrole.module +++ b/autoassignrole.module @@ -114,7 +114,7 @@ function autoassignrole_form_user_register_form_alter(&$form, &$form_state) { if ($roles) { $form['autoassignrole_user'] = array( '#type' => 'fieldset', - '#title' => filter_xss(variable_get('autoassignrole_user_fieldset_title', t('User Roles'))), + '#title' => t('User Roles'), '#collapsible' => FALSE, '#collapsed' => FALSE, ); @@ -132,16 +132,18 @@ function autoassignrole_form_user_register_form_alter(&$form, &$form_state) { $type = $user_selection == AUTOASSIGNROLE_ELEMENT_RADIO ? 'radios' : ($user_selection == AUTOASSIGNROLE_ELEMENT_CHECKBOX ? 'checkboxes' : 'select'); // If not multiple + not required + select box, need a none selection. - if (!$multiple && !variable_get('autoassignrole_user_required', 0) && $type == 'select') { + + $user_required = (variable_get('autoassignrole_user_required', 0)==0) ? FALSE : TRUE; + if (!$multiple && $user_required && ($type == 'select') ) { array_unshift(t('None'), $roles); } // Add in the element $form['autoassignrole_user']['user_roles'] = array( '#type' => $type, - '#title' => filter_xss(variable_get('autoassignrole_user_title', t('Role'))), + '#title' => t('Role'), '#options' => $roles, - '#description' => filter_xss(variable_get('autoassignrole_user_description', t('Select a role'))), + '#description' => t('Select a role'), '#required' => variable_get('autoassignrole_user_required', 0), '#multiple' => $multiple, '#options' => $roles,