- 🇮🇹Italy apaderno Brescia, 🇮🇹
#46149: Prevent account cancellation for uid 1 → changed
user_multiple_cancel_confirm()
which now skips user #1.$accounts = user_load_multiple(array_keys(array_filter($edit['accounts']))); foreach ($accounts as $uid => $account) { // Prevent user 1 from being canceled. if ($uid <= 1) { continue; } $form['accounts'][$uid] = array( '#type' => 'hidden', '#value' => $uid, '#prefix' => '<li>', '#suffix' => check_plain($account->name) . "</li>\n", ); } // Output a notice that user 1 cannot be canceled. if (isset($accounts[1])) { $redirect = count($accounts) == 1; $message = t('The user account %name cannot be cancelled.', array( '%name' => $accounts[1]->name, )); drupal_set_message($message, $redirect ? 'error' : 'warning'); // If only user 1 was selected, redirect to the overview. if ($redirect) { drupal_goto('admin/people'); } }
This means that, from the user interface which seems the case described in this issue, it is not possible to delete the user #1, from /admin/people.
I also created a new account with the administrator role, but even with that is not possible to delete the user #1, not even visiting user/1/edit, where the Cancel account button is missing.
With other accounts, including the second administrator user, the Cancel account button is visible (and it works).
I am closing this issue as duplicate of #46149: Prevent account cancellation for uid 1 → .
- Status changed to Closed: duplicate
5 months ago 6:14pm 18 April 2024