Title: Delete User
Last modified: February 28, 2020

---

# Delete User

 *  Resolved [vaidehiimedia](https://wordpress.org/support/users/vaidehiimedia/)
 * (@vaidehiimedia)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/delete-user-6/)
 * Hi,
 * I want to delete a user when the user clicks on “Delete Submission”.
 * Can you let me know what would be the best way to do that?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdelete-user-6%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [easyregistrationforms](https://wordpress.org/support/users/easyregistrationforms/)
 * (@easyregistrationforms)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/delete-user-6/#post-12497752)
 * Hello [@vaidehiimedia](https://wordpress.org/support/users/vaidehiimedia/),
 * Thank you for writing to us. There is no option to delete the user. Though you
   can use our hook to invoke a custom function call when a submission is deleted.
   Here is the sample code:
    add_action(‘erf_submission_deleted’,’handle_deletion’,
   10,3);
 * function handle_deletion($form,$submission,$user){
    // Custom code to delete 
   the user. }
 *  Thread Starter [vaidehiimedia](https://wordpress.org/support/users/vaidehiimedia/)
 * (@vaidehiimedia)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/delete-user-6/#post-12502125)
 * Thank you for your reply.
 *  Thread Starter [vaidehiimedia](https://wordpress.org/support/users/vaidehiimedia/)
 * (@vaidehiimedia)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/delete-user-6/#post-12503493)
 * Hello,
    require_once ERFORMS_PLUGIN_DIR . ‘erforms.php’; $user = wp_get_current_user();
   $userId = $user->ID;
 * $formID = get_user_meta($userId, ‘erf_form’, true);
    $submissionID = get_user_meta(
   $userId, ‘erf_submission’, true);
 * $form = erforms()->form->get_form($formID);
    $submission = erforms()->submission-
   >get_submission($submissionID); add_action(‘erf_submission_deleted’,’handle_deletion’,
   10,3);
 * function handle_deletion($form,$submission,$user){
    // Custom code to delete 
   the user. delete_user_meta($userId, ‘erf_submission’, $submissionID); wp_logout();}
 * I added this code in theme’s functions.php file but the action is not being called
   when submission is getting deleted.
 * Can you let me know what I am doing wrong?
 * Thanks,
    Vaidehi

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Delete User’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/easy-registration-forms_82b2df.svg)
 * [Easy Registration Forms](https://wordpress.org/plugins/easy-registration-forms/)
 * [Support Threads](https://wordpress.org/support/plugin/easy-registration-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-registration-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-registration-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-registration-forms/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [vaidehiimedia](https://wordpress.org/support/users/vaidehiimedia/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/delete-user-6/#post-12503493)
 * Status: resolved