• Resolved vaidehiimedia

    (@vaidehiimedia)


    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 to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author easyregistrationforms

    (@easyregistrationforms)

    Hello @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

    (@vaidehiimedia)

    Thank you for your reply.

    Thread Starter vaidehiimedia

    (@vaidehiimedia)

    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.