How can I checked as default the value Require e-mail confirmation to cancel account. It is unchecked as default :(

I tried to edit user.module editing this line '#default_value' => TRUE, but it doesn't work

  // Allow to send the account cancellation confirmation mail.
  $form['user_cancel_confirm'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require e-mail confirmation to cancel account.'),
    '#default_value' => TRUE,
    '#description' => t('When enabled, the user must confirm the account cancellation via e-mail.'),
  • I did that, and it worked for me. Could it be you're looking at a wrong page?
    – Kartagis
    Commented Aug 3, 2014 at 20:56

1 Answer 1


Consider never modifying core or contrib modules.

Instead, the right practice here is to use hook_form_alter() or hook_form_FORM_ID_alter() in a custom module.

So, configure a little module and put the following code in it:

function MY_MODULE_form_alter(&$form, &$form_state, $form_id) {
  //get your form id
  drupal_set_message("Form ID is : " . $form_id);
  switch($form_id) {
    case 'MY FORM ID':
      $form['user_cancel_confirm']['#default_value'] = 1;
    case 'OTHER FORM ID':
      //do sthing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.