I am using a form (gravity form) on my site. The form is inserted in a page (called form_page) on the users dashboard when they are logged in
http://example.com/dashboard/form_page
I am using a plugin (see below) to dynamically populate the form with content from the post the user is author to. However I need to pass the POST ID to the URL for it to work.
So the URL would end up looking like this
http://example.com/dashboard/form_page?gform_post_id=476
This works.
However, I am manually appending the ?gform_post_id=476
to the end of the URL to test the concept actually works and it does. However I have no idea how to dynamically pass this post ID to the end of the URL of the page for an Author who is logged in.
It might help to know that the “Author” will only have 1 post associated with them. So (out loud) I am thinking there might be a way to GET the POST_ID associated with the logged in USER and then pass it to the URL of that particular page.
I am just not sure how to connect the missing piece of this puzzle and would appreciate some guidance.
Cheers in advance…
My effort so far is as follows
<?php foreach(get_posts(array('author' => $author_id)) as $post)?>
<a href="http://example.com/dashboard/form_page?gform_post_id=<?php echo $post->ID ?>">Link</a>
But this seems to get first POST ID the site. Not the ID of the Authors POST. Note: It is a custom post.
Plugin used: http://wordpress.org/extend/plugins/gravity-forms-update-post/
First of all. The question is a little misleading. What you actually want is “post id(s) for current user”.
Here we go:
Now you can echo that $gform_post_id in your URL
Cheers