<?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: Save Newly Created User ID in Custom Post Type</title>
		<link>https://legacy.forums.gravityhelp.com/topic/save-newly-created-user-id-in-custom-post-type</link>
		<description>Gravity Support Forums Topic: Save Newly Created User ID in Custom Post Type</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 07:12:19 +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/save-newly-created-user-id-in-custom-post-type" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Save Newly Created User ID in Custom Post Type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/save-newly-created-user-id-in-custom-post-type#post-71219</link>
			<pubDate>Wed, 15 Aug 2012 18:58:54 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">71219@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Glad that worked (it was untested, but looked like it might work.)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jzsouthern on "Save Newly Created User ID in Custom Post Type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/save-newly-created-user-id-in-custom-post-type#post-71195</link>
			<pubDate>Wed, 15 Aug 2012 15:21:30 +0000</pubDate>
			<dc:creator>jzsouthern</dc:creator>
			<guid isPermaLink="false">71195@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Worked perfectly! I wasn't sure if the post was created before the user or vice-versa, and if the entry object was available to that hook.&#60;/p&#62;
&#60;p&#62;Thanks for the quick help!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Save Newly Created User ID in Custom Post Type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/save-newly-created-user-id-in-custom-post-type#post-71191</link>
			<pubDate>Wed, 15 Aug 2012 15:08:56 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">71191@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;When trying to use hooks like this, it's helpful to dump the $entry object and take a look at the information which is captured.  With that, you can see that the post ID is captured, and the hook definitely has the user ID available.  So, you can do something like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
// run with priority 10 and accept 4 parameters
add_action(&#38;#39;gform_user_registered&#38;#39;, &#38;#39;save_user_id_as_custom_field&#38;#39;, 10, 4);
function save_user_id_as_custom_field($user_id, $config, $entry, $user_pass) {
	// reference: http:// bit [dot] ly/NmVyE0
	update_post_meta($entry[&#38;#39;post_id&#38;#39;], &#38;#39;meta_key_name_of_your_custom_field&#38;#39;, $user_id);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Add that code to your theme's functions.php file.  Be sure to add or remove opening or closing PHP tags as necessary, depending on where you paste it.  You will have to change &#60;em&#62;meta_key_name_of_your_custom_field&#60;/em&#62; to the real name of your meta key where the CPT stores the user ID.&#60;/p&#62;
&#60;p&#62;Does that work for you?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jzsouthern on "Save Newly Created User ID in Custom Post Type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/save-newly-created-user-id-in-custom-post-type#post-71179</link>
			<pubDate>Wed, 15 Aug 2012 14:27:03 +0000</pubDate>
			<dc:creator>jzsouthern</dc:creator>
			<guid isPermaLink="false">71179@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've got a form that uses the User Registration Add-On to create a user account, and also created a Custom Post Type from other form data. One of the fields for the Custom Post Type is the User ID of the user who created the post. &#60;/p&#62;
&#60;p&#62;Since I'm allowing a user to register/subscribe and create the post in one step, I need a way to get the newly-created User ID and save it to the newly-created post. Seems like a gform_user_registered hook might be able to do this, but not sure how to make it all work together. &#60;/p&#62;
&#60;p&#62;Any help is greatly appreciated!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
