function apply_for_role_settings_form in Apply for role 5
Same name and namespace in other branches
- 6 apply_for_role.admin.inc \apply_for_role_settings_form()
- 7.2 apply_for_role.admin.inc \apply_for_role_settings_form()
- 7 apply_for_role.admin.inc \apply_for_role_settings_form()
1 string reference to 'apply_for_role_settings_form'
- apply_for_role_settings in ./
apply_for_role.module - Administration
File
- ./
apply_for_role.module, line 119 - Allows users to apply for roles.
Code
function apply_for_role_settings_form() {
$selected_roles = variable_get('users_apply_roles', array());
foreach ((array) $selected_roles as $rid => $value) {
if ($rid > 2) {
$selected_rids[] = $rid;
}
}
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Apply for role options'),
);
$form['options']['multiple'] = array(
'#type' => 'radios',
'#title' => t('Allow multiple roles per application'),
'#options' => array(
t('No'),
t('Yes'),
),
'#default_value' => variable_get('apply_for_role_multiple', 0),
'#description' => t("Chosing 'no' will limit users to applying for only one role per role application. Choosing 'yes' will allow users to apply for multiple roles per role application."),
'#required' => TRUE,
);
$form['options']['register'] = array(
'#type' => 'radios',
'#title' => t('Apply for role on registration'),
'#options' => array(
t('No'),
t('Optional'),
t('Required'),
),
'#default_value' => variable_get('apply_for_role_register', 0),
'#description' => t("Choosing 'optional' will allow users to apply for roles when creating a new account. Choosing 'required' will require users to apply for roles when creating a new account."),
'#required' => TRUE,
);
$roles = user_roles(TRUE);
unset($roles[DRUPAL_AUTHENTICATED_RID]);
$form['roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Roles'),
'#default_value' => isset($selected_rids) ? $selected_rids : array(
2,
),
'#options' => $roles,
'#description' => t('Select the roles that users will be able to apply for.'),
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
return $form;
}