From d96e6a54b60bf13d1ebc9a3db2ddfc3525535d2e Mon Sep 17 00:00:00 2001
From: Dries <dries@buytaert.net>
Date: Wed, 6 Mar 2013 21:42:49 -0500
Subject: [PATCH] Issue #1934788 by sun: 'Administration role' setting in User
 Account settings form defaults to first, randomly available user role.

---
 core/modules/user/user.admin.inc | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc
index 31c6beab9714..c3931d8490d4 100644
--- a/core/modules/user/user.admin.inc
+++ b/core/modules/user/user.admin.inc
@@ -314,17 +314,14 @@ function user_admin_settings($form, &$form_state) {
     '#type' => 'details',
     '#title' => t('Administrator role'),
   );
-
   // Do not allow users to set the anonymous or authenticated user roles as the
   // administrator role.
-  $roles = user_role_names();
-  unset($roles[DRUPAL_ANONYMOUS_RID]);
+  $roles = user_role_names(TRUE);
   unset($roles[DRUPAL_AUTHENTICATED_RID]);
-  $roles[0] = t('disabled');
-
   $form['admin_role']['user_admin_role'] = array(
     '#type' => 'select',
     '#title' => t('Administrator role'),
+    '#empty_value' => '',
     '#default_value' => $config->get('admin_role'),
     '#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.'),
-- 
GitLab