I gave the permission
cancel own user account to authenticated users.
Now they can see a
Cancel account button on their profile edit.
But when they click on that button, a confirmation form opens. That is fine.
On the confirmation form, when they click on the
Cancel account, they are redirected to their profile page with a message
A confirmation request to cancel your account has been sent to your email address.
I want to change this functionality. When they click on cancel account, they should not receive a confirmation cancellation email. Their account should be deleted immediately and they should be gets logged out.
I tried with this code but it is not working.
$form['user_cancel_confirm']['#default_value'] = FALSE;
Is this possible? How can I do this?