<?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: jw902</title>
		<link><a href='https://legacy.forums.gravityhelp.com/profile/jw902'>jw902</a></link>
		<description>Gravity Support Forums User Favorites: jw902</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 12:19:05 +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>sascha on "Passing post ID to function"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/passing-post-id-to-function#post-42164</link>
			<pubDate>Fri, 25 Nov 2011 05:58:08 +0000</pubDate>
			<dc:creator>sascha</dc:creator>
			<guid isPermaLink="false">42164@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi jw902,&#60;/p&#62;
&#60;p&#62;sorry, you must have a real name! Thanks for the code. Would it be possible if you could post the whole code/describe setup of how to edit an existing post with a form? So basically calling the right form, then letting the user edit it, changing the metadata and updating the form.&#60;br /&#62;
How do you set the expiry date? Do you use a custom field? In what data form do you save the data in there and calculate the difference?&#60;br /&#62;
I'm not a coder, just picking up bits here and there. Is it possible to see your working example too, if it is online?&#60;br /&#62;
Cheers,&#60;br /&#62;
Sascha
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jw902 on "Passing post ID to function"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/passing-post-id-to-function#post-34674</link>
			<pubDate>Wed, 07 Sep 2011 05:38:09 +0000</pubDate>
			<dc:creator>jw902</dc:creator>
			<guid isPermaLink="false">34674@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Sascha&#60;/p&#62;
&#60;p&#62;Sorry for the very slow reply - din't notice until this morning that there had been any more replies on this thread.&#60;/p&#62;
&#60;p&#62;If it's still of any help then I did kind of come up with a way to do it securely (though some might spot some holes in this method I've done some testing and it seems to work OK).  I couldn't find a way to obfuscate the query string without lots of lines of extra code so in the end I went for some conditional logic on the form page itself.  So basically I did the following - &#60;a href=&#34;http://www.pastie.org/2496286&#34; rel=&#34;nofollow&#34;&#62;http://www.pastie.org/2496286&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;The only thing this doesn't guard against is a logged in user entering a post ID that matches another one of their own posts into the URL.  To get around this I was thinking of writing a few lines of code that add 3 random numbers to the front of the ID number and to the end then stripping these away before I use them in variables etc.&#60;/p&#62;
&#60;p&#62;Hope this helps a bit - feel free to post again if you have any questions - I'll follow replies on this thread by email again&#60;/p&#62;
&#60;p&#62;Cheers!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sascha on "Passing post ID to function"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/passing-post-id-to-function#post-32386</link>
			<pubDate>Fri, 12 Aug 2011 11:29:49 +0000</pubDate>
			<dc:creator>sascha</dc:creator>
			<guid isPermaLink="false">32386@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi jw902,&#60;br /&#62;
how did you get on in the end? I'm just looking into exactly the same setup to let users edit only their own post/submissions. Did you find a way to secure the whole setup, so that not anyone just use the query string to change other users posts/submissions?&#60;/p&#62;
&#60;p&#62;Any ideas on that from the super helpful and knowledgeable Gravity Forms guys?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jw902 on "Passing post ID to function"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/passing-post-id-to-function#post-30377</link>
			<pubDate>Tue, 19 Jul 2011 04:57:59 +0000</pubDate>
			<dc:creator>jw902</dc:creator>
			<guid isPermaLink="false">30377@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi David - thanks very much for the reply.  So it looks as though I'm on the right track with the above - hadn't occurred to me to use get_post_meta - pretty obvious when it's put in front of you!&#60;/p&#62;
&#60;p&#62;The only bit about that solution I'm not so sure about is passing the post ID in a query string.  I know the vast majority of users wouldn't know how to manipulate one but if someone who does know what they're doing changes the ID they could potentially change up the expiry date of someone elses post.   Might need to look into ways of obfuscating the ID or something.  However, that's not really a GF question - one for Google!&#60;/p&#62;
&#60;p&#62;Thanks again for your help - I'll give what you suggest a go and see how I get on
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Passing post ID to function"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/passing-post-id-to-function#post-30339</link>
			<pubDate>Mon, 18 Jul 2011 16:14:54 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">30339@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Whatever link the user clicks on to extend the expiry date for a post, I would add that post ID as a variable in the query string.&#60;/p&#62;
&#60;p&#62;When the form loads, you can use the dynamic population option on the advanced tab of a hidden field to store the passed post ID from the query string.&#60;/p&#62;
&#60;p&#62;When the form is submitted, the post ID (now stored in the hidden field) will be submitted as part of the entry and will be accessible like so: &#60;strong&#62;$entry[12]&#60;/strong&#62; (updating the &#34;12&#34; to the ID of the hidden field).&#60;/p&#62;
&#60;p&#62;Now that you have the post ID in the &#60;strong&#62;gform_post_submission&#60;/strong&#62; function, you can use the WP function &#60;a href=&#34;http://codex.wordpress.org/Function_Reference/get_post_meta&#34; rel=&#34;nofollow&#34;&#62;get_post_meta&#60;/a&#62; to retrieve the current expiry date and &#60;a href=&#34;http://codex.wordpress.org/Function_Reference/update_post_meta&#34; rel=&#34;nofollow&#34;&#62;update_post_meta&#60;/a&#62; to update the expiry date.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jw902 on "Passing post ID to function"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/passing-post-id-to-function#post-30248</link>
			<pubDate>Mon, 18 Jul 2011 03:45:30 +0000</pubDate>
			<dc:creator>jw902</dc:creator>
			<guid isPermaLink="false">30248@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, hoping this is within the scope of support you can reasonably give.  I'm trying my hand at using of the developer hooks to achieve some stuff not available out of the box.   I'm trying to achieve the following:&#60;/p&#62;
&#60;p&#62;I have a loop containing posts from a custom post type (created by a specific author using a gravity form - no problems with this, all working as it should)&#60;/p&#62;
&#60;p&#62;Each item in this loop is a job post that has an expiry date (so that the system knows when to turn it into a draft).  This expiry date is calculated using the date of publication/posting and adding either 14, 30 or 45 days depending on what the user selected when they posted (again no problems with the logic for this - I have it all working elsewhere).&#60;/p&#62;
&#60;p&#62;For each item in this loop I want to have a link that takes the user to a gravity form that allows them to update the expiry date by adding an extension of either 5, 10 or 15 days.  The system would then add this many days to the current expiry date associated with that post (in a custom field) and update the post.&#60;/p&#62;
&#60;p&#62;Having scoured the documentation and forums I've got as far as the code below:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
// Updates expiration field on post extension form
add_action(&#38;quot;gform_post_submission_4&#38;quot;, &#38;quot;form_update_expiry_date&#38;quot;, 10, 2);
function form_update_expiry_date($entry,$form){
$targetPost = $entry[&#38;quot;1&#38;quot;];  //Gets the value of form field which is dynamically populated with the post ID passed to it via a query string
$new_date = $entry[&#38;quot;2&#38;quot;]; //Gets the value of form field containing a new date - this is not really what I need though - did this more for a proof of concept
global $wpdb;
$wpdb-&#38;gt;query(&#38;quot;UPDATE $wpdb-&#38;gt;postmeta SET meta_value= &#38;#39;$new_date&#38;#39; WHERE post_id=$targetPost AND meta_key=&#38;#39;expiry date&#38;#39;&#38;quot;);
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I'm using a query string to grab the ID of the post that the form should edit and passing that to a variable to use later in the wpdb query.&#60;/p&#62;
&#60;p&#62;The biggest problem with the above block of code is that I need to somehow get the custom field value for the current expiry date.  At the moment the code just doesn't really do what I need it to do and I'm really not sure that I'm doing things in the most straightforward way.&#60;/p&#62;
&#60;p&#62;My question is this:&#60;/p&#62;
&#60;p&#62;How would I pass the ID of the post to be edited to the form so that I can access values within that posts custom fields (assuming this can even be done?).  It's just occurred to me that I could probably pass the expiry date custom field value to the form using a query string though that would leave it open to URL manipulation (someone could change the date or ID which isn't great).&#60;/p&#62;
&#60;p&#62;Any pointers would be great - can probably muddle through once I know how to pass the ID to the function above is a more robust way (maybe using the &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name&#34; rel=&#34;nofollow&#34;&#62;Gform field value hook&#60;/a&#62; to pass the value to the form then grabbing the value from the form?). &#60;/p&#62;
&#60;p&#62;Many thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sriganesh on "Updating custom fields from post page[single.php]?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/updating-custom-fields-from-post-pagesinglephp#post-29829</link>
			<pubDate>Tue, 12 Jul 2011 16:27:03 +0000</pubDate>
			<dc:creator>sriganesh</dc:creator>
			<guid isPermaLink="false">29829@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks for the reply.&#60;/p&#62;
&#60;p&#62;Is &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Developer_Docs&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Developer_Docs&#60;/a&#62; the only resource for more information on this? &#60;/p&#62;
&#60;p&#62;Could you direct me to more tuts/tips on these in general?&#60;br /&#62;
I would want to try/learn these out myself and hiring developers is the last option.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Updating custom fields from post page[single.php]?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/updating-custom-fields-from-post-pagesinglephp#post-29828</link>
			<pubDate>Tue, 12 Jul 2011 16:16:16 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">29828@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;It's possible, but only as a customization. Out of the box Gravity Forms does not edit existing posts, it only creates new posts.  So if you wanted a form that can edit a post you would have to write custom code using the available API hooks to accomplish this.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sriganesh on "Updating custom fields from post page[single.php]?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/updating-custom-fields-from-post-pagesinglephp#post-29827</link>
			<pubDate>Tue, 12 Jul 2011 16:12:11 +0000</pubDate>
			<dc:creator>sriganesh</dc:creator>
			<guid isPermaLink="false">29827@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62; I would like to know if the following is possible with GF.&#60;/p&#62;
&#60;p&#62;I want to embed a form within each post below the post content which would update  few custom fields associated with that post.&#60;/p&#62;
&#60;p&#62;eg.&#60;br /&#62;
Let us say I have a tab  that outputs a custom field called &#34;New information&#34;  below the post content, which would be updated right from the form on that page (after some validation).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Lee Hord on "log in &#38; values saved for each user"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/log-in-values-saved-for-each-user#post-29205</link>
			<pubDate>Wed, 06 Jul 2011 10:58:49 +0000</pubDate>
			<dc:creator>Lee Hord</dc:creator>
			<guid isPermaLink="false">29205@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I thought I'd post this as I've seen many posts on the forum about this very subject.  I too had a similar requirement and this is how I solved it.  May not be the most elegant piece of code ever written but it certainly does the job.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_post_submission_87&#38;quot;, &#38;quot;my_update_user_meta&#38;quot;, 10, 2);
function my_update_user_meta( $entry, $form ) {
	global $current_user;
		   get_currentuserinfo();
		   $user_id = $current_user-&#38;gt;ID;

	update_user_meta($user_id, &#38;#39;ouc&#38;#39;, $entry[15]);

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Obviously you would need to change form and entry id's to suit.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
