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.

Creating a form to add data to post page upon submission?

  1. reelseo
    Member

    Im not sure how to explain this other than to tell you exactly what Im trying to do and see if you know if it can be done. Basically, Id like to create a post asking our readers to submit a youtube URL to us in a form at the bottom of the post, along with their name, email, etc.... Then, if this is possible (and this is where I'd love your thoughts), Id love it if that information could be added to the post itself or below the post somehow after it's been submitted. Is it possible to do that?

    So, Im reading a post, I fill out a form giving my name, email, and youtube link (for example), and then I hit submit, refresh the page, and then see that my entry was received and is inline?

    This is somewhat a work around for the fact that I cant customize the comments form as Id like to ask for example, for a youtube URL. I suppose that the other option, though Im not aware that it exists - is, can I use gravity forms to augment the comment form in wordpress?

    Any thoughts or ideas on how I could accomplish something like this? Even if not with Gravity form Im stuggling to find a solution and need to launch something so any thoughts or feedback you have would be really helpful.

    Thanks in advance.

    Posted 12 years ago on Friday December 2, 2011 | Permalink
  2. It's certainly possible, but it's not something Gravity Forms is going to do for you without some work on your part. Practically anything is possible with Gravity Forms through the use of it's wide array of hooks and filters.

    This particular customization could be done through the use of the 3rd party Gravity Forms Custom Post Types Add-On and then the bulk of the work would actually be theme customization related.

    Here is what I suggest:

    1) Create a custom post type specifically for these posts. You'll have to decide what to name the custom post type based on what you are trying to accomplish. It could be Submissions, User Submissions, whatever. If you aren't familiar with custom post types, you may need to read up on them and their usage. This would allow you to create posts that don't get displayed with your blog posts and are for this specific use only.

    Custom Post Types are explained in the codex here:
    http://codex.wordpress.org/Post_Types

    A good plugin to create and manage custom post types can be found here:
    http://wordpress.org/extend/plugins/custom-post-type-ui/

    2) Install the 3rd party Gravity Forms Custom Post Types Add-On. This will allow you to create a form that creates a post that is stored as the custom post type you create in #1 above. This plugin can be found here:

    http://wordpress.org/extend/plugins/gravity-forms-custom-post-types/

    3) Create your Gravity Form using the fields you want. Use the Post Fields for the post related data. Utilize the options added by the custom post types add-on mentioned in #2 above to tell Gravity Forms to store the post as the custom post type you crease in #1 above.

    Add a Post Custom Field to this form. Edit it and select the field type of Hidden and give it a field label of Parent Post and a new custom field name of parentid. See this screenshot:

    http://dl.dropbox.com/u/185347/Slingshot/Pictures/Screen%20Shot%202011-12-02%20at%207.01.14%20PM.png

    On your Parent Post custom field, select the Advanced tab and in the Default Value field select the embed post/page id variable from the insert variable drop down directly above the Default Value input. That will insert the merge tag for the post/page id the form is submitted from. See this screenshot:

    http://dl.dropbox.com/u/185347/Slingshot/Pictures/Screen%20Shot%202011-12-02%20at%207.01.55%20PM.png

    Now your form will create a custom post type post which will include a custom field with the name parentid that stores the post id of the post the form was submitted from.

    4) This is where the heavy lifting comes in. Create a custom theme template. Where you want these user submissions to appear, you will have to create a WordPress loop that outputs all the posts from the custom post type you created where the custom field with the name parentid is equal to the post id of the current post.

    You will have to have an understanding of how WordPress works, primarily theme related functionality, in order to do the above. But that's a high level overview of what you would need to do to accomplish what you want to do.

    Posted 12 years ago on Saturday December 3, 2011 | Permalink
  3. Hi Carl,

    What would you suggest for me? I am a newbie here also. I have created a Gravity form so that I could get users to submit their music. I've created a "Submit" tab on the website so that when a user presses that they can complete the Gravity form and submit their music.

    Firstly, the problem I have is that the completed forms appears as a draft blog post. However much of the content is missing and I don't want to necessarily complete all the SEO, tags etc as I would in the case of a real blog. In fact it feels that if I use this method I am not saving time but writing a new blog post via the information I have received in my email (which has not fully followed through to the draft blog post). The title has but not the music link or the paragraph form.

    Secondly, if I do approve and post this user generated blog post it appears as a new blog post each time on the front page of my website. I didn't necessarily wan that when I approve a piece of music a new blog post is generated on the front page.

    It sounds like the steps above may also be what I need to follow. Is this correct?

    Lastly, if I did some form of automatic user upload would this literally mean that once they upload that is it - I don't approve it. Or does it simply mean it is uploaded in the correct format with the need for alteration?

    Thank you.

    Posted 12 years ago on Sunday December 4, 2011 | Permalink
  4. @Nigel - you can choose to publish the post rather that mark it as draft. Find the post body field in your form and select "Publish" from the drop down, rather than draft. It looks like this: http://min.us/mHpehua4j

    To prevent the posts from appear on the home page of your site, I would put all the music posts into one category, then exclude that category from the loop that displays blog posts. This is WordPrss configuration, not Gravity Forms, as Gravity Forms just collects the data and creates the post. How it's displayed is up to you. You can learn more about excluding one category from the front page of the blog here: http://www.google.com/search?q=exclude+one+category+from+blog+homepage+wordpress

    Or there are plugins to do it. Or, depending on your theme, they might have options as well.

    I'm not sure what your final question is. You can accept submissions and create posts in Draft, Published or Pending status. Draft is intended to mean you're still working on it. Pending means it just needs to be reviewed before publishing. And Published means it goes live immediately. You can always edit the post later, but it will be posted without moderation.

    Please let us know if you have more questions.

    Posted 12 years ago on Sunday December 4, 2011 | Permalink
  5. @Chris: Thanks for getting back to me. I will take your advice and think I will add one of the wordpress plug-ins. Stealth publish sounds to be a good one and seems to do what I want.

    On anoyher note I had my Gravity form set to pending. However, I see that in the post section of the form set up I did not select 'Post Body' but selected another sub category. I have realised that this was the reason why the post body did not filter through to my word press blog - whereas everything else did. I've now amended this. What should now happen is that the wordpress post is pre-populated with all of the fields I have selected in Gravity forms allowing me to just press the send button.

    I'm thinking about the paypal option, but will look into that in more detail.

    Thanks.

    Posted 12 years ago on Monday December 5, 2011 | Permalink
  6. Please let us know if you need any more help. Thanks for the update.

    Posted 12 years ago on Monday December 5, 2011 | Permalink
  7. reelseo
    Member

    This is great... thank you soo much for giving me such a detailed response. I wish I was more of a develop[er... Any chance I could pay someone on your end to do this for me?

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink
  8. Raquel Kohler
    http://cckstudio.com

    Ounce of Talent
    http://www.ounceoftalent.com

    Zach Katz
    http://www.katzwebservices.com

    Jake Goldman
    http://www.get10up.com

    Scott Kingsley Clark
    http://scottkclark.com

    WebDevStudios
    http://www.webdevstudios.com

    There is a larger list of developers with Gravity Forms experience here (although I can't guarantee they all know what they are doing):

    http://wpcandy.com/pros/experienced/with-gravity-forms

    If you still have issues let us know and we'll try to put you in touch with a developer who can assist you.

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink
  9. Hey @reelseo

    Just an idea: if you follow Carl's suggestions 1, 2 and 3; number 4 can be achieved using PluginBuddy's LoopBuddy.

    This kind of thing is exactly what LoopBuddy is designed for. The only problem you might have is that your theme's loop might need to be updated to The Loop Standard that LoopBuddy requires. This is still a lot easier than creating a whole new page template with a custom loop though.

    Posted 12 years ago on Wednesday December 14, 2011 | Permalink