Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As the title suggests I want to prevent user 1 from being deleted. At least not that easy. This can become an issue when you give site admins the permission "Administer Users". In a recent project one of our site admins accidentally did just that, deleted user 1. This patch maybe to harsh but it's a start. User 1 is a special case in Drupal and shouldn't be that easy delete I think.
Comment | File | Size | Author |
---|---|---|---|
#3 | 202404-181735.png | 32.82 KB | apaderno |
#3 | 202404-181732.png | 31.11 KB | apaderno |
#3 | 202404-181721.png | 32.12 KB | apaderno |
#2 | After_patch_apply.png | 6.36 KB | vikashsoni |
#2 | patch_apply.png | 21.69 KB | vikashsoni |
Comments
Comment #1
dcam CreditAttribution: dcam commentedFor future reference, the issue status must be set to Needs review in order to trigger our automatic Testbot.
This is more of a new feature though. As such, it will likely need to be bumped up to Drupal 8 since new features must be added to the current development version first. Then they can be considered for backport.
Comment #2
vikashsoni CreditAttribution: vikashsoni as a volunteer and at Zyxware Technologies commentedThanks @StoraH
patch is working fine now we are not able to delete user with have 1 uid sharing screenshot ....
Comment #3
apaderno#46149: Prevent account cancellation for uid 1 changed
user_multiple_cancel_confirm()
which now skips user #1.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.
Comment #4
apaderno