You are here

function adminrole_form_user_admin_settings_alter in Admin role 7

Same name and namespace in other branches
  1. 6 adminrole.module \adminrole_form_user_admin_settings_alter()

Implements hook_form_FORM_ID_alter().

File

./adminrole.module, line 11
This module simply gives a designated role all permissions every time the modules page is submitted.

Code

function adminrole_form_user_admin_settings_alter(&$form, $form_state) {

  // Administrative role option.
  $form['admin_role'] = array(
    '#type' => 'fieldset',
    '#title' => t('Administrator role'),
  );

  // Do not allow users to set the anonymous or authenticated user roles as the administrator role.
  $roles = user_roles();
  unset($roles[DRUPAL_ANONYMOUS_RID]);
  unset($roles[DRUPAL_AUTHENTICATED_RID]);
  $form['admin_role']['user_admin_role'] = array(
    '#type' => 'select',
    '#title' => t('Administrator role'),
    '#default_value' => variable_get('user_admin_role', 0),
    '#options' => array(
      0 => t('Disabled'),
    ) + $roles,
    '#description' => t('This role will be automatically assigned new permissions whenever a module is enabled, field is added/updated or an entity is added/updated.'),
  );
}