<?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: Getting Form Object outside of standard hooks</title>
		<link>https://legacy.forums.gravityhelp.com/topic/getting-form-object-outside-of-standard-hooks</link>
		<description>Gravity Support Forums Topic: Getting Form Object outside of standard hooks</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 20:24:56 +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/getting-form-object-outside-of-standard-hooks" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Getting Form Object outside of standard hooks"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/getting-form-object-outside-of-standard-hooks#post-105677</link>
			<pubDate>Sat, 22 Dec 2012 00:47:25 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">105677@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Since you are going direct to the database, you can use the form ID to query the wp_rg_form_meta table.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;SELECT display_meta FROM
wp_rg_form_meta
WHERE form_id = $_GET[&#38;quot;formid&#38;quot;];&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;That will return a serialized array of all the form metadata. You can then use the php unserialize function to convert the data:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
$form_meta = unserialize($data);
// debug?
// print_r($form_meta);
// retrieve the form title from the
// serialized form_meta array
$form_title = $form_meta[&#38;#39;title&#38;#39;];&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Does that get you the information you need?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zerotofive on "Getting Form Object outside of standard hooks"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/getting-form-object-outside-of-standard-hooks#post-105044</link>
			<pubDate>Thu, 20 Dec 2012 15:20:17 +0000</pubDate>
			<dc:creator>zerotofive</dc:creator>
			<guid isPermaLink="false">105044@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This is a somewhat uncommon request, but I have a client that wants to provide a custom HTML formatted email once a month to users.  The users should only receive product notices based on their choices in their sign up form that they initially signed up with.&#60;/p&#62;
&#60;p&#62;I am using a Cron Job to process the PHP code.  It will loop through all the users and return the relevant lead ID from the database (already working).  My question now is - I know the form ID, I know the lead ID - but how do I get the form OBJECT so I can start to manipulate it and pull data from it?&#60;/p&#62;
&#60;p&#62;Below is the code I have in the for each user loop - please help!&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;global $wpdb;

		//Figuring out if user has submitted form before
		$sql = &#38;quot;SELECT filtered.sort, l.*, d.field_number, d.value
		FROM wp_rg_lead l
		INNER JOIN wp_rg_lead_detail d ON d.lead_id = l.id
		INNER JOIN
		(
			SELECT @rownum:=@rownum + 1 as sort, id
			FROM
			(
				SELECT distinct l.id
				FROM wp_rg_lead l
				INNER JOIN wp_rg_lead_detail d ON d.lead_id = l.id
				WHERE
				l.form_id=&#38;quot;. $_GET[&#38;quot;formid&#38;quot;] .&#38;quot;

				 AND created_by=&#38;quot;. $iUserID .&#38;quot;
				 AND status=&#38;#39;active&#38;#39;

				ORDER BY date_created DESC
				LIMIT 1

			) page
		) filtered ON filtered.id = l.id
		ORDER BY filtered.sort&#38;quot;;

		//initializing rownum
		$wpdb-&#38;gt;query(&#38;quot;select @rownum:=0&#38;quot;);

		//getting results
		$results = $wpdb-&#38;gt;get_results($sql);

		$resultArray = array();

		foreach( $results as $result ){
			$leadID = $result-&#38;gt;id;
		}
		echo $leadID;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The code above does return the correct leadID, but for some reason in the for each results it does loop multiple times when it should only loop once for one result.  I am not concerned with that near as much as getting the form object so I can get the relevant checkbox data though.&#60;/p&#62;
&#60;p&#62;Thanks for any help.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
