<?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: gform_post_data - Updating a post</title>
		<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post</link>
		<description>Gravity Support Forums Topic: gform_post_data - Updating a post</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 20:34:22 +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/gform_post_data-updating-a-post" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-71391</link>
			<pubDate>Thu, 16 Aug 2012 23:57:12 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">71391@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Looks good.   Thank you for the update.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Noel Green on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-71329</link>
			<pubDate>Thu, 16 Aug 2012 12:14:38 +0000</pubDate>
			<dc:creator>Noel Green</dc:creator>
			<guid isPermaLink="false">71329@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;GOT IT!&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// update the &#38;quot;12&#38;quot; to the ID of your form
add_filter(&#38;quot;gform_post_submission_12&#38;quot;, &#38;quot;gform_set_post_thumbnail&#38;quot;);
function gform_set_post_thumbnail($entry){

    // get the last image added to the post
    $attachments = get_posts(array(&#38;#39;numberposts&#38;#39; =&#38;gt; &#38;#39;1&#38;#39;, &#38;#39;post_parent&#38;#39; =&#38;gt; $postID, &#38;#39;post_type&#38;#39; =&#38;gt; &#38;#39;attachment&#38;#39;, &#38;#39;post_mime_type&#38;#39; =&#38;gt; &#38;#39;image&#38;#39;, &#38;#39;order&#38;#39; =&#38;gt; &#38;#39;DESC&#38;#39;));

    if(sizeof($attachments) == 0)
        return; //no images attached to the post

    // set image as the post thumbnail
    set_post_thumbnail($postID, $attachments[0]-&#38;gt;ID);
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Noel Green on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-70160</link>
			<pubDate>Wed, 08 Aug 2012 11:43:32 +0000</pubDate>
			<dc:creator>Noel Green</dc:creator>
			<guid isPermaLink="false">70160@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Okay... here's what I'm trying now... to no avail.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action( &#38;#39;gform_after_submission_6&#38;#39;, &#38;#39;gf_edit_student&#38;#39;, 10, 2 );
function gf_edit_student( $entry, $form ) {
global $post;
global $wpdb;
global $wp_query;
$postID = $wp_query-&#38;gt;post-&#38;gt;ID;

$post_thumbnail = $wpdb-&#38;gt;get_var(&#38;quot;SELECT ID FROM $wpdb-&#38;gt;posts WHERE post_parent = &#38;#39;$post-&#38;gt;ID&#38;#39; AND post_status = &#38;#39;inherit&#38;#39; AND post_type=&#38;#39;attachment&#38;#39; ORDER BY post_date DESC LIMIT 1&#38;quot;);

$post_thumbnailID = wp_get_attachment_metadata($post_thumbnail);

set_post_thumbnail($postID, $post_thumbnailID);
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-70121</link>
			<pubDate>Wed, 08 Aug 2012 09:51:20 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">70121@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Please let us know how it goes.  Thank you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Noel Green on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-70109</link>
			<pubDate>Wed, 08 Aug 2012 09:11:48 +0000</pubDate>
			<dc:creator>Noel Green</dc:creator>
			<guid isPermaLink="false">70109@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks!&#60;br /&#62;
I'll try it and let you know...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-69891</link>
			<pubDate>Tue, 07 Aug 2012 11:22:01 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">69891@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Do you want to set the most recently uploaded image as the featured image then?  You probably want to use &#60;em&#62;set_post_thumbnail&#60;/em&#62; in the function you hooked to gform_after_submission.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://codex.wordpress.org/Function_Reference/set_post_thumbnail&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Function_Reference/set_post_thumbnail&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Grab the last attachment to the post, and set that as the post thumbnail.  Can you try that?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Noel Green on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-69840</link>
			<pubDate>Tue, 07 Aug 2012 08:38:35 +0000</pubDate>
			<dc:creator>Noel Green</dc:creator>
			<guid isPermaLink="false">69840@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have a form that let's people submit an image to a post which is already set. The form uses the gform_after_submission and update_post_meta to update the fileds on the form, but I'm not sure how to have it set the featured image.  It uploads the image just fine... but having the &#34;set as featured image&#34; box checked on the upload box in the admin side doesn't effect the function because it's editing, not creating, a post.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-69809</link>
			<pubDate>Tue, 07 Aug 2012 01:53:11 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">69809@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;@parkeast, please ask your question here and explain what you would like to do, and what you've already tried, and we can help address your issue specifically.  Thank you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Noel Green on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-69776</link>
			<pubDate>Mon, 06 Aug 2012 23:22:46 +0000</pubDate>
			<dc:creator>Noel Green</dc:creator>
			<guid isPermaLink="false">69776@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Did you ever figure this out?  I'm looking for the same thing.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jacobdubail on "gform_post_data - Updating a post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_post_data-updating-a-post#post-36269</link>
			<pubDate>Mon, 26 Sep 2011 18:06:52 +0000</pubDate>
			<dc:creator>jacobdubail</dc:creator>
			<guid isPermaLink="false">36269@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey guys,&#60;/p&#62;
&#60;p&#62;I'm doing a bunch of custom stuff with my forms and need a little help figuring out one last step.&#60;/p&#62;
&#60;p&#62;Here's a bit of background:&#60;br /&#62;
 - I'm using my form to create a custom post&#60;br /&#62;
 - When the custom post is saved/published, a row is inserted into a custom table&#60;br /&#62;
 - I need my second form (an update form) to update this custom post&#60;br /&#62;
 - I'm using gform_post_data_2 to target my update form&#60;/p&#62;
&#60;p&#62;I'm trying to figure out how to update the featured image of the post.  I can't find any functions that will do it for me.&#60;/p&#62;
&#60;p&#62;Anyone have any tips?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Jacob
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
