<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Delete lead on another forms submission</title>
		<link>https://legacy.forums.gravityhelp.com/topic/delete-lead-on-another-forms-submission</link>
		<description>Gravity Support Forums Topic: Delete lead on another forms submission</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 09:18:06 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/delete-lead-on-another-forms-submission" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Delete lead on another forms submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/delete-lead-on-another-forms-submission#post-78730</link>
			<pubDate>Wed, 03 Oct 2012 16:12:11 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">78730@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;gform_post_submission is deprecated. Use gform_after_submission now.  Usage is identical.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>iamdangavin on "Delete lead on another forms submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/delete-lead-on-another-forms-submission#post-78711</link>
			<pubDate>Wed, 03 Oct 2012 15:32:35 +0000</pubDate>
			<dc:creator>iamdangavin</dc:creator>
			<guid isPermaLink="false">78711@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Been playing with this for a few hours now. Still nothing. I have tried gform_post_submission as well. The form still gets caught up. If I dont have the foreach loop it will delete the entry that was just pushed through, but I need to find the entry within another form...&#60;/p&#62;
&#60;p&#62;Any thoughts?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>iamdangavin on "Delete lead on another forms submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/delete-lead-on-another-forms-submission#post-78687</link>
			<pubDate>Wed, 03 Oct 2012 11:51:21 +0000</pubDate>
			<dc:creator>iamdangavin</dc:creator>
			<guid isPermaLink="false">78687@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am trying to use a form with the form ID 2 that has a dropdown option of restaurants along with an email input field. The user can choose the restaurant they were going to attend, enter their email address and then when submitted it will find their entry that matches the restaurant &#38;amp; email from form ID 1 and delete it.&#60;/p&#62;
&#60;p&#62;I am using this, but the submission of the form never goes through, nor does it delete anyone...&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// Form ID 2
add_action(&#38;quot;gform_after_submission_2&#38;quot;, &#38;quot;gf_remove_rsvp_entry&#38;quot;, 10, 2);
function gf_remove_rsvp_entry($entry, $form){

	$email = $_POST[&#38;quot;input_1&#38;quot;];
	$restaurant = $_POST[&#38;quot;input_2&#38;quot;];

    //Reading entries from our RSVP Form ID 1;
    $entries = RGFormsModel::get_leads(1, &#38;#39;&#38;#39;, &#38;#39;DESC&#38;#39;, &#38;#39;&#38;#39;, &#38;#39;0&#38;#39;, &#38;#39;99999999&#38;#39;);
    foreach($entries as $entry){
    	if($email == $entry[&#38;quot;4&#38;quot;] &#38;amp;&#38;amp; $restaurant == $entry[&#38;quot;9&#38;quot;]){

			// Get our Leads
			$lead_id                = $entry[&#38;#39;id&#38;#39;];
			$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-&#38;gt;prepare( &#38;quot; DELETE FROM $lead_detail_long_table
									WHERE lead_detail_id IN(
									SELECT id FROM $lead_detail_table WHERE lead_id=%d
									)&#38;quot;, $lead_id );
			$wpdb-&#38;gt;query( $sql );

			// Delete from lead details
			$sql = $wpdb-&#38;gt;prepare( &#38;quot;DELETE FROM $lead_detail_table WHERE lead_id=%d&#38;quot;, $lead_id );
			$wpdb-&#38;gt;query( $sql );

			// Delete from lead notes
			$sql = $wpdb-&#38;gt;prepare( &#38;quot;DELETE FROM $lead_notes_table WHERE lead_id=%d&#38;quot;, $lead_id );
			$wpdb-&#38;gt;query( $sql );

			// Delete from lead
			$sql = $wpdb-&#38;gt;prepare( &#38;quot;DELETE FROM $lead_table WHERE id=%d&#38;quot;, $lead_id );
			$wpdb-&#38;gt;query( $sql );

    	}
    }

}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
