PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

User-Generated Post Title, Content, and Image

  1. jcener
    Member

    Hi, I bought this plugin as an alternative to TDO Mini Forms. We're trying to accomplish the following:

    1) Have a Form that allows a visitor to enter a post title, post content, and image
    2) On Submit, the form should turn this into a Post in Draft status
    3) Once reviewed, we publish the user generated post with the title as inputted, content as inputted, and the image at the bottom.

    After reading the review at http://wpblogger.com/gravity-forms-plugin-review.php, it seems like this easily done, but I can't figure out how to get the images to show up. They have been successfully uploaded to the correct wp-upload/gravity/year/month directory, but won't show up in the post.

    I'd like to stay away from using custom fields, but will if its the only way. Please let me know! If this works, this plugin is WELL worth it.

    Thanks,
    Justin

    Posted 14 years ago on Thursday January 21, 2010 | Permalink
  2. The Post Image field uploads the image to the Media Library and attaches it to the Gallery for the Post that is created. Just like in WordPress, images don't display in the body of a post automatically when you upload them. You have to manually insert them. They don't automatically get added to the Body.

    This is the same with Gravity Forms. The Post Body is separate from the Post Image.

    You have a couple options. Since the post is a draft, as part of the approval/editing process you would have to insert the image yourself when you approve and publish the post. This gives you control over moderating the image and approving of it before inserting it.

    The other option is to add this functionality to your theme file. Insert code in your theme that checks for Gallery image (or Gallery sequence 1 image) and display it that way.

    We do plan on implementing an enhanced Post Body feature that will enable you to control the markup that is used for the Post Body so that you can then use variables for other fields (including image fields) to output them in the Post Body. This is tentatively planned for the 1.4 release.

    Posted 14 years ago on Thursday January 21, 2010 | Permalink
  3. jcener
    Member

    Carl,

    Thanks for your super fast reply. Would you be able to show me some example code that would pull the image from the gallery? I have a little experience with custom key fields and implementing them inside the code.

    Thanks,
    Justin

    Posted 14 years ago on Thursday January 21, 2010 | Permalink
  4. Sure, it's not the same as displaying a custom key field. But it will get you more comfortable with more advanced theme usage. It will require adding code to your themes functions.php file and then a function call in your theme itself.

    For a little background, anytime you upload an image from within the Edit Post/Page interface it gets attached to the Gallery for that post. When you create a post with Gravity Forms that includes a Post Image field, it works the same way. It is added to your Media Library and associated with the Gallery for the post that is created.

    Here is some information:

    http://www.wprecipes.com/how-to-get-the-first-image-from-the-post-and-display-it

    http://www.livexp.net/wordpress/get-the-first-image-from-the-wordpress-post-and-display-it.html

    http://wphackr.com/get-images-attached-to-post/

    Some of the tutorials above are more advanced (the last one in particular). Hope that helps!

    Posted 14 years ago on Thursday January 21, 2010 | Permalink
  5. jcener
    Member

    Carl,

    Thanks so much for your detailed help and links. I will try this out and hopefully report a working site!!

    Thanks,
    Justin

    Posted 14 years ago on Friday January 22, 2010 | Permalink
  6. Some good search terms to try searching for on Google on this subject are:

    "WordPress post image"

    "WordPress first gallery image"

    Posted 14 years ago on Friday January 22, 2010 | Permalink
  7. jcener
    Member

    Carl,

    I'm at a bit of a loss right now. I implemented the basic function found at http://www.wprecipes.com/how-to-get-the-first-image-from-the-post-and-display-it and can confirm that it works with other posts that had images uploaded and placed. Ex the image under the sharing icons: http://loyalpetloss.com/caring-for-jordie-during-renal-failure-507.html

    Unfortunately, for the 2 test posts I made with a post-image upload via Gravity, this function doesn't pull the image, eventhough I can confirm that it is saved in the post gallery like you said.

    This is what I did:

    1) Edit Functions.php to include the new function
    2) Edit single.php to include the new function call

    I am missing a step somewhere?

    Thanks,
    Justin

    Posted 14 years ago on Friday January 22, 2010 | Permalink
  8. jcener
    Member

    I also realized that if I manually add the image to the post, the function will work and show the image uploaded by Gravity, but that doesn't solve the problem.

    Posted 14 years ago on Friday January 22, 2010 | Permalink
  9. We will try the functions ourselves. It might be a few days before we post back with information on our results. The team will be traveling to Boston tomorrow for WordCamp Boston.

    Posted 14 years ago on Friday January 22, 2010 | Permalink
  10. jcener
    Member

    Carl,

    OK no problem, I appreciate it! I'll check back later next week - enjoy WordCamp!

    Also, is there a way to set up a preview of what the user has inputted before he/she submits it?

    Thanks,
    Justin

    Posted 14 years ago on Friday January 22, 2010 | Permalink
  11. Currently there is no preview style confirmation page. It is a featured we are considering for a future release. However, with uploads, the upload has to occur for the preview to be possible.

    Posted 14 years ago on Monday January 25, 2010 | Permalink
  12. jcener
    Member

    Carl,

    Did you have any success trying out the function?

    Thanks,
    Justin

    Posted 14 years ago on Monday January 25, 2010 | Permalink
  13. jcener
    Member

    Carl,

    "We will try the functions ourselves. It might be a few days before we post back with information on our results. The team will be traveling to Boston tomorrow for WordCamp Boston."

    Any luck with those functions?

    Posted 14 years ago on Friday March 5, 2010 | Permalink
  14. jcener
    Member

    Carl,

    Another question: is it possible to set the post's author using Gravity? When a post is created, its saved as a draft. Once published, the author is written as the admin's name instead of the name of the person who submitted.

    -Justin

    Posted 14 years ago on Friday March 5, 2010 | Permalink
  15. We haven't had a chance to do more testing on this as we have been busy with version releases and development, but I will look into it.

    It is possible to set the post author. Author is an option on the Post Title and Post Body fields. You can default the author, or set it to set the author to the user filling out the form if they are logged into your WordPress site.

    Author has to be a WordPress user. So they have to be logged into your site and WordPress has to know who they are in order to set the Author to something other than the default.

    Posted 14 years ago on Friday March 5, 2010 | Permalink
  16. jcener
    Member

    Carl,

    Thanks, please let me know when you have tested those functions. If those work, that would make this plugin incredible!!

    Thanks,
    Justin

    Posted 14 years ago on Thursday March 11, 2010 | Permalink
  17. And is there any news regarding showing image in post ?

    Posted 14 years ago on Tuesday September 28, 2010 | Permalink
  18. @Neso yes, you can insert an image into a post using the new Post Content Template functionality that is an option on the Post Body field. It allows you to dynamically create the Post Body content using form field variables the same way you create dynamic notification email body messages... using form field variables.

    Posted 14 years ago on Tuesday September 28, 2010 | Permalink