I am sure that I am not the only one who has deleted a user on Moodle by accident. You would think it is very unlikely, but I can assure you, it is not. Especially if you have to maintain a busy environment, lots of tasks and requests, please change this and please change that.
It is a little bit scary, especially if you don't have access to the database directly, you are only a site admin on the front end. As you might know, when you delete a user on the Site administration, you don't really delete the user from the database.
When you actually delete a user account on the Site administration page, you don't really delete them from the database. You can restore the user account if you have access to the database, you only have to change the mdl_user.deleted flag from 1 to 0 again.
If an account is deleted by mistake, it can be partially restored by resetting the deleted flag to zero in the database and resetting the username and email address. User profile details, user preferences, enrolments, and group and cohort membership data cannot be recovered. Grades may be recovered by re-enrolling the user into their courses and ticking the 'Recover user's old grades if possible' checkbox in the enrolment options. Forum posts are not deleted.
Even it is not the end of the world, but you definitely want to avoid that headache.
Why don't we just hide the delete button using CSS, so no one will be able to click on it accidentally? If you wish to retain any data, you should instead suspend the user's account. And to hide the button is not even difficult.
Go to your theme's CSS setting page and add the following:
As you can see, from now on no one can click on the trash icon, you are safe. If you need to delete someone, you can make them visible again, even just temporarily using Chrome Developer Tools and disable the display: none; setting.
Enjoy and come back later for more...