0

I have a User Role called Supervisor which can create new accounts of role Supervisor.

The Supervisor can also delete other users with supervisor role. While deleting Other users the Supervisor gets the 4 choices that Drupal comes standard with:-

enter image description here

However, I want to present the Supervisor only the first option:-
Disable the account and keep its content
and other options to be hidden or disabled by default.

I'd be very thankful for any hints how to achieve that... I'm already using Role Delegation module and have been trying different settings, looks like its not possible via that module.

1

I would start by creating a custom module and try using hook_form_alter.

function MYMODULE_form_alter(&$form, $form_state, $form_id)  {
  switch ($form_id)  {
    case 'user-multiple-cancel-confirm':
        // ALTER STUFF.. user dsm($form) to show available fields.
        break;
   }
} 

Using

global $user; 
$roles = $user->roles; // Array with user assigned roles

you can check the array for the Supervisor role.

  • 1
    just a minor issue... $form_id will only return the form's title. $form will return the fields. – kreynen Dec 10 '14 at 20:25
  • You're totally right! I've updated the answer. – robbieronald Dec 11 '14 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy