From ba5468e508877767affb6c517b0d0555c0904c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= <gabor@hojtsy.hu> Date: Tue, 22 Jan 2008 07:51:56 +0000 Subject: [PATCH] #119038 by ximo, Pancho: user role editing usability: include disabled checkbox for authenticated role --- modules/user/user.module | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/user/user.module b/modules/user/user.module index d1b562c7eacf..08b94e3cd3b0 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1422,14 +1422,38 @@ function user_edit_form(&$form_state, $uid, $edit, $register = FALSE) { ); } if ($admin) { - $form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => isset($edit['status']) ? $edit['status'] : 1, '#options' => array(t('Blocked'), t('Active'))); + $form['account']['status'] = array( + '#type' => 'radios', + '#title' => t('Status'), + '#default_value' => isset($edit['status']) ? $edit['status'] : 1, + '#options' => array(t('Blocked'), t('Active')) + ); } if (user_access('administer permissions')) { $roles = user_roles(TRUE); + + // The disabled checkbox subelement for the 'authenticated user' role + // must be generated separately and added to the checkboxes element, + // because of a limitation in D6 FormAPI not supporting a single disabled + // checkbox within a set of checkboxes. + // TODO: This should be solved more elegantly. See issue #119038. + $checkbox_authenticated = array( + '#type' => 'checkbox', + '#title' => $roles[DRUPAL_AUTHENTICATED_RID], + '#default_value' => TRUE, + '#disabled' => TRUE, + ); + unset($roles[DRUPAL_AUTHENTICATED_RID]); if ($roles) { $default = empty($edit['roles']) ? array() : array_keys($edit['roles']); - $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => $default, '#options' => $roles, '#description' => t('The user receives the combined permissions of the %au role, and all roles selected here.', array('%au' => t('authenticated user')))); + $form['account']['roles'] = array( + '#type' => 'checkboxes', + '#title' => t('Roles'), + '#default_value' => $default, + '#options' => $roles, + DRUPAL_AUTHENTICATED_RID => $checkbox_authenticated, + ); } } -- GitLab