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.

Embedding formatted Entry fields into a Post body?

  1. btickler
    Member

    I have been reading through the documentation, but I am brand new to Gravity Forms and sort of stuck at the moment. I am trying to figure out how to accomplish what I am looking for:

    My form is at http://www.dlantern.com, under the menu headings Nominations -> Nominate Someone.

    I am submitting nominations as posts, and have used the post title, body and tag fields etc., but there is also other data being entered. It works, and I get an "Entry" for each nomination, and I get a post in pending review...the notifications work, etc.

    What I need to do is take some (not all) of the fields that end up in the Entry, or the notification Emails, and add them to the post body as text, transforming them a little bit on the way.

    So, for example in this case, nominations have a nickname for the nominator and for the nominee to protect privacy, which I would like to the top of the post in a format like:

    "Nominated by: JohnD90210
    On: (date/timestamp of form submission
    Location: (state/province), (country)"

    But nominations also have full name and Email fields that I do not want to embed in the post, so some kind of method of dumping in everything automatically won't work in this case.

    Also, the tags are populating correctly, so the nominations can be searched for by tag, but I also want to list each tag field in the body of the post, like this:

    "Country: xxx
    State/Province: xxx
    Area Code: xxx
    Zip Code: xxx

    Gender: xxx
    Age Group: xxx"

    If I am barking up the wrong tree in terms of the best way to accomplish this let me know...but my site goes live Monday, and I am not a PHP coder, so something along these lines seems like the best possibility :), if I can figure out how to funnel those fields into the post body via the Gravity Forms interface.

    If that's not possible, I am open to suggestions, and while I am a newbie with Gravity Forms, I'm also a former Oracle/Sybase DBA and a pretty good systems analyst ;), so fire away with whatever advice you want and don't worry that it will be too confusing. I basically know *what* should be possible to do with PHP and MySQL (and WordPress and Gravity Forms), just not how to do it yet ;).

    It would be great to know the ideal way to do this, but also some way for a newbie to get it working in a limited but functionally-all-there way by the end of the week :).

    Posted 13 years ago on Tuesday June 14, 2011 | Permalink
  2. If you want to use the value of some form fields in the content of the Post that is created you can use the Content Template option on the Post Body field.

    The Content Template lets you manipulate the post content and create the content using the value of any field on your form. It is similar to how you create your Notifications and the Confirmation message where you can insert merge tags for form fields that are then processed and replaced the the actual field value.

    - Edit your form
    - Edit your Post Body field
    - Check the Content Template checkbox
    - Configure the content template. You use the "Insert form field" drop down to insert merge tags which are replaced with the field values.

    Whatever you place in the content template is what will be used to create the Post Body for the post that is created.

    Posted 13 years ago on Tuesday June 14, 2011 | Permalink
  3. btickler
    Member

    Cool, thanks :). Not sure how I missed that, but I am not sure it talks about that specific application of functionality much in the documentation links.

    I will try that out tonight.

    Posted 13 years ago on Tuesday June 14, 2011 | Permalink
  4. We will be creating a tutorial for the content template soon to provide more in depth information on how to use it.

    Posted 13 years ago on Wednesday June 15, 2011 | Permalink
  5. btickler
    Member

    No worries :).

    Posted 13 years ago on Wednesday June 15, 2011 | Permalink
  6. btickler
    Member

    Ok, cool, it works ;)...I'm wondering on the image upload, though...is there a way to set the post's featured image? I was able to embed it into the post but not make the uploaded image the featured image.

    Posted 13 years ago on Friday June 17, 2011 | Permalink
  7. Here is a forum post that discusses how to set it as the post thumbnail or feature image depending on how you customize the code.

    http://www.gravityhelp.com/forums/topic/auto-setting-the-the_post_thumbnail?

    Please note that when using the gform_post_submission hook if you call it like this:

    add_filter("gform_post_submission", "set_post_thumbnail", 10, 2);

    That applies that code to all of your forms. If you append the form id to the end of gform_post_submission like this:

    add_filter("gform_post_submission_5", "set_post_thumbnail", 10, 2);

    That will apply that custom code only to that form id, in this example it would be form id 5.

    We do plan on making this a built in feature in a future release.

    Posted 13 years ago on Friday June 17, 2011 | Permalink