diff -Naur protect_critical_users/protect_critical_users.module protect_critical_users.new/protect_critical_users.module --- protect_critical_users/protect_critical_users.module 2008-11-19 22:51:00.000000000 +0100 +++ protect_critical_users.new/protect_critical_users.module 2011-09-27 13:54:48.427768481 +0200 @@ -20,8 +20,12 @@ drupal_goto($uid == 0 ? '' : 'user/'. $uid .'/edit'); } else if ($uid == $user->uid) { - drupal_set_message(t('Oops! You cannot delete your own account!'), 'error'); - drupal_goto('user/'. $uid .'/edit'); + // Own account deletion managed by user_delete module, if present + // @see http://drupal.org/node/507890 + if (!module_exists('user_delete')) { + drupal_set_message(t('Oops! You cannot delete your own account!'), 'error'); + drupal_goto('user/'. $uid .'/edit'); + } } } @@ -48,7 +52,7 @@ // Remove delete button from user 1 edit form. if ($form_id == 'user_profile_form' && isset($form['delete']) && isset($form['_account']['#value']->uid)) { - if ($form['_account']['#value']->uid == 1 || $form['_account']['#value']->uid == $user->uid) { + if ( $form['_account']['#value']->uid == 1 || ($form['_account']['#value']->uid == $user->uid && !module_exists('user_delete')) ) { unset($form['delete']); } }