Commit d96e6a54 authored by Dries's avatar Dries

Issue #1934788 by sun: 'Administration role' setting in User Account settings...

Issue #1934788 by sun: 'Administration role' setting in User Account settings form defaults to first, randomly available user role.
parent 6bf13bd8
...@@ -314,17 +314,14 @@ function user_admin_settings($form, &$form_state) { ...@@ -314,17 +314,14 @@ function user_admin_settings($form, &$form_state) {
'#type' => 'details', '#type' => 'details',
'#title' => t('Administrator role'), '#title' => t('Administrator role'),
); );
// Do not allow users to set the anonymous or authenticated user roles as the // Do not allow users to set the anonymous or authenticated user roles as the
// administrator role. // administrator role.
$roles = user_role_names(); $roles = user_role_names(TRUE);
unset($roles[DRUPAL_ANONYMOUS_RID]);
unset($roles[DRUPAL_AUTHENTICATED_RID]); unset($roles[DRUPAL_AUTHENTICATED_RID]);
$roles[0] = t('disabled');
$form['admin_role']['user_admin_role'] = array( $form['admin_role']['user_admin_role'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Administrator role'), '#title' => t('Administrator role'),
'#empty_value' => '',
'#default_value' => $config->get('admin_role'), '#default_value' => $config->get('admin_role'),
'#options' => $roles, '#options' => $roles,
'#description' => t('This role will be automatically assigned new permissions whenever a module is enabled. Changing this setting will not affect existing permissions.'), '#description' => t('This role will be automatically assigned new permissions whenever a module is enabled. Changing this setting will not affect existing permissions.'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment