function autoassignrole_settings in Auto Assign Role 5.2
Same name and namespace in other branches
- 5 autoassignrole.module \autoassignrole_settings()
1 string reference to 'autoassignrole_settings'
- autoassignrole_menu in ./
autoassignrole.module - Implementation of hook_menu().
File
- ./
autoassignrole.module, line 37
Code
function autoassignrole_settings() {
$roles = user_roles();
// Unset Anonymous & Authenticated RID.
unset($roles[1]);
unset($roles[2]);
$form['autoassignrole_settings_auto'] = array(
'#type' => 'fieldset',
'#title' => t('Automatic Role Assignment'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['autoassignrole_settings_auto']['AUTOASSIGNROLE_ROLE_ACTIVE'] = array(
'#type' => 'radios',
'#title' => t('Automatic role assignment'),
'#description' => t('Automatic role assignment occurs when the user first logins to the account. This happens without the users knowledge'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE_ACTIVE', 0),
'#options' => array(
1 => t('Enabled'),
0 => t('Disabled'),
),
);
$form['autoassignrole_settings_auto']['AUTOASSIGNROLE_ROLE'] = array(
'#type' => 'checkboxes',
'#title' => t('Role(s)'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE', ''),
'#options' => $roles,
'#description' => t('Select the roles to assign new users.'),
);
$form['autoassignrole_settings_user'] = array(
'#type' => 'fieldset',
'#title' => t('User Role Assignment'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['autoassignrole_settings_user']['AUTOASSIGNROLE_ROLE_USER_ACTIVE'] = array(
'#type' => 'radios',
'#title' => t('User Role Assignment'),
'#description' => t('The end user will be allowed to select the following roles when they log in.'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE_USER_ACTIVE', 0),
'#options' => array(
1 => t('Enabled'),
0 => t('Disabled'),
),
);
$form['autoassignrole_settings_user']['AUTOASSIGNROLE_ROLE_USER'] = array(
'#type' => 'checkboxes',
'#title' => t('Role'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE_USER', ''),
'#options' => $roles,
'#description' => t('Select the roles that are offered to new users.'),
);
$form['autoassignrole_settings_user']['AUTOASSIGNROLE_ROLE_USER_MULTIPLE'] = array(
'#type' => 'radios',
'#title' => t('User Role Selection'),
'#description' => t('Should the end user be allowed to choose a single role or can they choose multiple roles?'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE_USER_MULTIPLE', 0),
'#options' => array(
0 => t('Single Role'),
1 => t('Multiple Roles'),
),
);
$form['autoassignrole_settings_user']['AUTOASSIGNROLE_ROLE_USER_REQUIRED'] = array(
'#type' => 'checkbox',
'#title' => t('Required'),
'#description' => t('Should the end user be required to choose a role?'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE_USER_REQUIRED', 0),
);
$form['autoassignrole_settings_user']['AUTOASSIGNROLE_ROLE_SORT'] = array(
'#type' => 'select',
'#title' => t('Sorting'),
'#description' => t('Default sort order of roles the user will see.'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE_SORT', 'SORT_ASC'),
'#options' => array(
'SORT_ASC' => t('Ascending'),
'SORT_DESC' => t('Descending'),
),
);
$form['autoassignrole_settings_user']['AUTOASSIGNROLE_ROLE_USER_FIELDSET'] = array(
'#type' => 'textfield',
'#title' => t('User Role Fieldset Title'),
'#description' => t('The title of the fieldset that contains role options.'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE_USER_FIELDSET', t('User Role Selection')),
'#size' => 60,
'#maxlength' => 128,
'#required' => FALSE,
);
$form['autoassignrole_settings_user']['AUTOASSIGNROLE_ROLE_USER_TITLE'] = array(
'#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_ROLE_USER_TITLE', t("Role")),
'#size' => 60,
'#maxlength' => 128,
'#required' => FALSE,
);
$form['autoassignrole_settings_user']['AUTOASSIGNROLE_ROLE_USER_DESCRIPTION'] = array(
'#type' => 'textarea',
'#title' => t('User Role Description'),
'#description' => t('The description displayed to the end user when they are selecting thier role during registration.'),
'#default_value' => variable_get('AUTOASSIGNROLE_ROLE_USER_DESCRIPTION', ""),
'#required' => FALSE,
);
return system_settings_form($form);
}