0

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?

2

1 Answer 1

0

Seems the Cancel Account Separate Form module does exactly what you want. It provides a form that finally calls user_cancel with the current user's UID as parameter.

This is a very simple, lightweight module that provides cancel user account separate form and adds it to user edit form by default if user has cancel account permissions and edits his own account.

1
  • Will check the cancel account separate Form module now.
    – Ahmad
    Dec 16, 2019 at 10:58

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.