You are here

function autoassignrole_auto_settings in Auto Assign Role 7.2

Same name and namespace in other branches
  1. 7 autoassignrole.admin.inc \autoassignrole_auto_settings()

Form builder; The settings form for automatic role assignment.

See also

system_settings_form()

1 string reference to 'autoassignrole_auto_settings'
autoassignrole_menu in ./autoassignrole.module
Implements hook_menu().

File

./autoassignrole.admin.inc, line 36
Administrative functionality for auto assign role.

Code

function autoassignrole_auto_settings() {
  $form['autoassignrole_auto_active'] = array(
    '#type' => 'radios',
    '#title' => t('Automatic role assignment'),
    '#default_value' => variable_get('autoassignrole_auto_active', 0),
    '#description' => t('Automatic role assignment occurs when the user first logins to the account. This happens without the users knowledge. Set to Enabled to allow this functionality or Disabled to not allow.'),
    '#options' => array(
      1 => t('Enabled'),
      0 => t('Disabled'),
    ),
  );
  $form['autoassignrole_admin_active'] = array(
    '#type' => 'radios',
    '#title' => t('Automatic role assignment for admin created accounts'),
    '#default_value' => variable_get('autoassignrole_admin_active', 0),
    '#description' => t('Automatic role assignment occurs when the user first logins to the account. This happens without the users knowledge. Set to Enabled to allow this functionality or Disabled to not allow.'),
    '#options' => array(
      1 => t('Enabled'),
      0 => t('Disabled'),
    ),
    '#states' => array(
      'visible' => array(
        ':input[name="autoassignrole_auto_active"]' => array(
          'value' => 1,
        ),
      ),
    ),
  );
  if ($roles = autoassignrole_get_roles()) {
    $form['autoassignrole_auto_roles'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Roles'),
      '#default_value' => variable_get('autoassignrole_auto_roles', array()),
      '#description' => t('Check the specific roles the user will automatically be assigned to when created by an administrator or through the new user registration process. The Authenticated User role is automatically assigned by Drupal core and can not be edited.'),
      '#options' => $roles,
      '#states' => array(
        'visible' => array(
          ':input[name="autoassignrole_auto_active"]' => array(
            'value' => 1,
          ),
        ),
      ),
    );
  }
  return system_settings_form($form);
}