function apply_for_role_settings_form in Apply for role 6
Same name and namespace in other branches
- 5 apply_for_role.module \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()
Module settings page.
1 string reference to 'apply_for_role_settings_form'
- apply_for_role_menu in ./
apply_for_role.module - Implementation of hook_menu().
File
- ./
apply_for_role.admin.inc, line 12 - Administration forms for the Apply for Role module.
Code
function apply_for_role_settings_form(&$form_state) {
$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,
);
$form['options']['display_approved'] = array(
'#type' => 'radios',
'#title' => t('Display approved roles in an application form'),
'#options' => array(
t('No'),
t('Yes'),
),
'#default_value' => variable_get('apply_for_role_display_approved', 0),
'#description' => t("Choosing 'yes' will allow a user to see which role applications where approved."),
'#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;
}