<?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 User Favorites: paulburd</title>
		<link><a href='https://legacy.forums.gravityhelp.com/profile/paulburd'>paulburd</a></link>
		<description>Gravity Support Forums User Favorites: paulburd</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 21:54:39 +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/profile/" rel="self" type="application/rss+xml" />

		<item>
			<title>Brenda Egeland on "Auto setting the &#34;the_post_thumbnail&#34;"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/auto-setting-the-the_post_thumbnail#post-18368</link>
			<pubDate>Fri, 11 Feb 2011 22:00:59 +0000</pubDate>
			<dc:creator>Brenda Egeland</dc:creator>
			<guid isPermaLink="false">18368@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you so much! Perfect for what I need.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mor10 on "Auto setting the &#34;the_post_thumbnail&#34;"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/auto-setting-the-the_post_thumbnail#post-17879</link>
			<pubDate>Mon, 07 Feb 2011 22:22:58 +0000</pubDate>
			<dc:creator>mor10</dc:creator>
			<guid isPermaLink="false">17879@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks Alex. This is exactly what I was looking for. It's a bit too well hidden though, especially considering how many people are asking for this particular function. Maybe make this thread a sticky in the forum so people find it easily?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Auto setting the &#34;the_post_thumbnail&#34;"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/auto-setting-the-the_post_thumbnail#post-16983</link>
			<pubDate>Tue, 25 Jan 2011 12:25:32 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">16983@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi webrulon, that should be added to your functions.php
&#60;/p&#62;</description>
		</item>
		<item>
			<title>webrulon on "Auto setting the &#34;the_post_thumbnail&#34;"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/auto-setting-the-the_post_thumbnail#post-16967</link>
			<pubDate>Tue, 25 Jan 2011 04:05:47 +0000</pubDate>
			<dc:creator>webrulon</dc:creator>
			<guid isPermaLink="false">16967@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, what file should the above code be added to?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Gmorales on "Auto setting the &#34;the_post_thumbnail&#34;"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/auto-setting-the-the_post_thumbnail#post-12675</link>
			<pubDate>Sun, 14 Nov 2010 06:35:57 +0000</pubDate>
			<dc:creator>Gmorales</dc:creator>
			<guid isPermaLink="false">12675@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Great! thank you so much, it works perfectly.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "Auto setting the &#34;the_post_thumbnail&#34;"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/auto-setting-the-the_post_thumbnail#post-5394</link>
			<pubDate>Tue, 11 May 2010 11:39:44 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">5394@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;&#60;strong&#62;EDIT (July 2011)&#60;/strong&#62;&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#60;strong&#62;PLEASE NOTE:&#60;/strong&#62; This code is out of date and no longer works.&#60;/p&#62;
&#60;p&#62;Please see this post instead:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/forums/topic/fatal-error-when-using-the_post_thumbnail-code-snippet#post-30918&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/topic/fatal-error-when-using-the_post_thumbnail-code-snippet#post-30918&#60;/a&#62;&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;I like your idea about having some sort of collaboration on these code snippets. Could work really well.&#60;/p&#62;
&#60;p&#62;Try the following code snippet to set your post thumbnails&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Ignore the code below&#60;/strong&#62;&#60;br /&#62;
&#60;strike&#62;&#60;br /&#62;
add_filter(&#34;gform_post_submission&#34;, &#34;set_post_thumbnail&#34;, 10, 2);&#60;br /&#62;
function set_post_thumbnail($entry, $form){&#60;/p&#62;
&#60;p&#62;    //Replace 4 with your actual form id&#60;br /&#62;
    if($form[&#34;id&#34;] != 4)&#60;br /&#62;
        return;&#60;/p&#62;
&#60;p&#62;    //getting first image associated with the post&#60;br /&#62;
    $post_id = $entry[&#34;post_id&#34;];&#60;br /&#62;
    $attachments = get_posts(array('numberposts' =&#38;gt; '1', 'post_parent' =&#38;gt; $post_id, 'post_type' =&#38;gt; 'attachment', 'post_mime_type' =&#38;gt; 'image', 'order' =&#38;gt; 'ASC'));&#60;br /&#62;
    if(sizeof($attachments) == 0)&#60;br /&#62;
        return; //no images attached to the post&#60;/p&#62;
&#60;p&#62;    //setting first image as the thumbnail for this post&#60;br /&#62;
    update_post_meta( $post_id, '_thumbnail_id', $attachments[0]-&#38;gt;ID);&#60;/p&#62;
&#60;p&#62;}&#60;br /&#62;
&#60;/strike&#62;&#60;br /&#62;
&#60;strong&#62;EDIT (July 2011)&#60;/strong&#62;&#60;br /&#62;
See this post for an updated solution:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/forums/topic/fatal-error-when-using-the_post_thumbnail-code-snippet#post-30918&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/topic/fatal-error-when-using-the_post_thumbnail-code-snippet#post-30918&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>drewbaker on "Auto setting the &#34;the_post_thumbnail&#34;"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/auto-setting-the-the_post_thumbnail#post-5360</link>
			<pubDate>Mon, 10 May 2010 13:45:23 +0000</pubDate>
			<dc:creator>drewbaker</dc:creator>
			<guid isPermaLink="false">5360@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey Guys,&#60;br /&#62;
Does anyone know how to have the &#34;the_post_thumbnail&#34; set when a post is submitted via a form? I'm happy for it to just be the first image attached.&#60;/p&#62;
&#60;p&#62;Alex The Admin said it was possible in a pre-sale post here: &#60;a href=&#34;http://forum.gravityhelp.com/topic/multiple-image-attachment&#34; rel=&#34;nofollow&#34;&#62;http://forum.gravityhelp.com/topic/multiple-image-attachment&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Thanks for the help! Great plugin!&#60;/p&#62;
&#60;p&#62;PS: You guys should have some sort of user-edited code snippet repository along the lines of the wordpress CODEX for this kind of thing. Would save your admins a lot of work on the forums.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
