I initially opened an issue to try to add this level of protection to Drupal core itself, but the issue has been marked as "won't fix".

Since I use several sites, and I do not always use the same user name on them, I'm afraid I may end up removing UID 1. Since it is actually possible, and Drupal itself doesn't prevent me from doing so, I decided to implement this level of protection with a contrib module.

If anyone else is interested, it can be found here:
http://forums.phpmix.org/viewtopic.php?t=1008

I haven't created a module in Drupal repository (maybe thinking that it could be finally fixed in the Drupal core itself), so there would be no other place than this thread (or my forums) for any question you may have with the module.

Comments

oadaeh’s picture

You should go through the process of making this a contrib module if you want it in core. It is unlikely that it will be included otherwise.

markus_petrux’s picture

The module is already available as an attachment of the forum topic I mentioned above. Do you mean it worths to commit to the Drupal contributions repository?

Doubt is the beginning, not the end of wisdom.

oadaeh’s picture

What I mean that it is more likely to be incorporated into Drupal's core if it is one of the contributed modules on http://drupal.org/project/Modules than if it is an attachment on a forum on a different Web site. I think that your module has merit and I suspect that it would be used by a lot of people, but it probably won't be included in Drupal's core, nor used by as many people, if it's off-site. Go through the process of getting a CVS account and submit your package as a regular contribution to Drupal. It is possible that someone will pick up on it in the future and include the functionality in Drupal.

markus_petrux’s picture

True, in Drupal's CVS will reach more people. Thanks for the feedback. TBH, I wasn't sure what to do.

I have created a project and committed the files to the contributions repository.

It is also branched for 4.7, so I believe the tar file now depends on the cvs crons.

Doubt is the beginning, not the end of wisdom.

oadaeh’s picture

If there are differences between the 4.6 and 4.7 versions of your module, you will want to branch your project to the 4.6 tag, and then update CVS to the 4.7 version, so that both are available. I am myself unsure of the details, but I believe they can be found starting here: http://drupal.org/repos

markus_petrux’s picture

1) In 4.6 there is not a form_alter hook, so it is not possible to hide the Delete button. Not so nice, not so critical anyway, if we can still intercept the delete request.

2) In 4.6, I had to check for arg(2)=='delete' (like in 4.7), but also for $_POST['op']==t('Delete'). Slight difference, but it didn't work from hook_init, I had to use hook_menu. The language system doesn't seem to be available at hook_init time in 4.6, oh!

After some tests, I believe I also got it for 4.6 and so, it has also been branched and committed to CVS.

@all who may be interested in this module:
Please, take care if you use it. First, check if it works. Do NOT confirm user delete operations. This module should intercept the attempt. That is, when you press the Delete button, you should see a "403 access denied" error. If you don't, something is wrong with the module. My fault. In that case, feel free to come back here (*) ...to slap me.

(*) better yet, an issue to the project page.

Doubt is the beginning, not the end of wisdom.

oadaeh’s picture

Good job.

markus_petrux’s picture

Thanks :-)

Doubt is the beginning, not the end of wisdom.

yched’s picture

It seems you removed the module from cvs/contrib, because "There doesn't seem to be interest in this." (cvs comment)

Well, maybe that comes a little late, but I was interested :-)
I didn't really understand why the patch you submitted for core didn't get committed in the first place...

markus_petrux’s picture

This one can be found here:
http://forums.phpmix.org/viewtopic.php?t=1008

I'll be keeping my modules available from my site. Much easier for me to keep up to date.

Doubt is the beginning, not the end of wisdom.