PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Email notification not sending after deleting entry with hook

  1. 45north


    I'm deleting form records after submission using gform_post_submission and have also tried gform_after_submission. Deleting the record works great, but I no longer get the email notification - if I comment out deleting the entry from the database I get the email no problem. It looks like these hooks are before the user email notifications are sent out - is there a way to manually force-send the email notification or use the hook differently to make sure notifications go out?

    add_action('gform_post_submission_1', 'process_order', 10, 2);
    function process_order($entry, $form)
    	// do stuff
    function remove_form_entry($entryId)
    	global $wpdb;
    	$lead_id = $entryId;
    	$lead_table = RGFormsModel::get_lead_table_name();
    	$lead_notes_table = RGFormsModel::get_lead_notes_table_name();
    	$lead_detail_table = RGFormsModel::get_lead_details_table_name();
    	$lead_detail_long_table = RGFormsModel::get_lead_details_long_table_name();
    	//Delete from detail long
    	$sql = $wpdb->prepare(" DELETE FROM $lead_detail_long_table
    		WHERE lead_detail_id IN(
    			SELECT id FROM $lead_detail_table WHERE lead_id=%d
    		)", $lead_id);
    	//Delete from lead details
    	$sql = $wpdb->prepare("DELETE FROM $lead_detail_table WHERE lead_id=%d", $lead_id);
    	//Delete from lead notes
    	$sql = $wpdb->prepare("DELETE FROM $lead_notes_table WHERE lead_id=%d", $lead_id);
    	//Delete from lead
    	$sql = $wpdb->prepare("DELETE FROM $lead_table WHERE id=%d", $lead_id);
    Posted 11 years ago on Thursday March 15, 2012 | Permalink