CustomPress + Gravity Forms

I am testing using Gravity Forms (GF) to create a front-end tool to let users submit custom posts (in "pending review" mode) via CustomPress (CP).

I add the post type and a selection of fields in CP, and then I go over to Gravity Forms and try to add the entry field for each of the CP fields there using the Custom Field button, but the fields I've added via CP are not showing up.

If I try to force a connection by using "New" field in GF and the paste the name of the new custom field ("Field ID") generated by CP and in to the GF box for New Custom Field, it still doesn't connect to the new field created via CP. (I was hoping I could convince the two to talk nicely by using the same field ID in both places.)

This all works as expected when using the Types and More Fields plugins (i.e. new custom fields created by using Types and More Fields show up as expected in GF), but I was hoping to use CustomPress instead. And yes, I have deactivated Types and More Fields so I can try out CP, and I have been using discrete names for everything to prevent conflicts.

Oddly enough, I was having the same issue with PODS, hence the switch to Types. I was hoping CP would work better...has some advantages, I think?

When I check in at the Gravity Forms list, the submission appears there (and is sent to me in an auto-email as per my GF settings), but when I look at the custom post type's entry list, nothing appears there, so the connection between the two isn't happening.

I saw several other people have posted the same question in here, but no-one seems to have either found or shared a solution; there are just a lot of abandoned-and-closed discussions on the topic, therefore your help on this renewed topic is much appreciated.

TIA!

ea/

  • EA

    Hi Arnold,

    1) Yes, I checked the WP and other plugins can use this custom field checkbox. Even double-checked to make sure I'd done it.
    2) Field IDs all start with ct_
    3) None of the ct_ fields show up in the list of fields I can map the custom post fields to in GF unless I add them (again?!) as a "new" field (copy-paste from field ID), which makes no sense and makes me wonder how on earth two separate plugins can use the exact same field names each for their own use...which, of course, they can't...

    More ideas? Want to log in and see if I'm being daft?

    Thanks!

    ea/

  • EA

    Done.

    You'll see four fields in the Gravity Forms selection that match the name, but that's because I added them as "new" in GF using copy-paste. There's a fifth field in CP that doesn't show up in GF, one that I added via CP last night and didn't try to create in GF.

    Just so you know what I've been up to...

    GF->custom post works as expected if I turn off CP and turn on More Fields and Types. At least it did a few days ago. (heh.)

    Thanks Arnold.

  • Arnold

    OK I see what your doing. Ther no place in Gravity Forms to set a Custom Post type. So it always refers to Posts. So when you make a custom field that's related to a custom post type it won't show because gravity forms only looks at Posts. If your custom field was ralted to posts it would appear in Gravity's list.

    But your wanting the form to change your custom post types data. Gravity can't do that directly. You might could add this plugin.

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

    http://yoast.com/gravity-forms-custom-post-types/

  • EA

    Hi Arnold,

    Thanks for taking a look.

    I already have Gravity Forms + Custom Post Types installed and activated, have had it there for some time now, so what am I still missing re: connecting GF fields to CustomPress fields?

    Should I just go back to Types and More Fields, which does create fields GF can see (presumably via GF+CPT) and give up on CustomPress? :slight_frown:

    I really appreciate your help.

  • Arnold

    You probably need an exemplar. Custom fields are not predefined in WP so until you actually created an instance of the field, WP can't know it exists.

    For example your Price field which wasn't showing in the list. I went to your one Test Event entry and the Price was blank so there was no instance of it in the database. I put in 10 to give it a value and it now appears in the Gravity form dropdown.

    The way it builds that list is to take all posts of a given post type and collect all their existing custom fields and add their ID to the list. If none has been created yet then there is nothing to find.

  • EA

    Thank you, Arnold.

    I still struggled with this for a while this morning, so I finally turned off CP and turned back on Types and More Fields to see what I had done there in the hopes that it would give me ideas for here. I also reviewed the video I took of a consultation where I got help making Types/MF work, too.

    Along the way I created a new form, and again it didn't work! The form worked, but not the post.. Turned out that this time I'd forgotten to use the Advanced Tab in GF to select the Post Type that I wanted the form fields to map to. doh!

    Even after I solved that, the same issue with GF not displaying the new CPT's in the drop-down list of existing fields occurred with those plugins, too. What I did with those was copy-paste the slug into the "New Field" box in GF, and that worked as it had before.

    I went back to CP (turned off Types and MF again) and tried it all again, using the slug copy-paste approach instead of a whole 'nother step of creating a standalone exemplar, and, happily, it worked this time! Now I have to figure out how to display the posts in the order of my custom date field instead of by post date, but that would be a separate topic.

    As I found this process a little complicated (at least, it seemed to me like there was a missing link), I've created a how-to guide for myself so I don't forget what to do the next time I come at this, especially if I have a little gap between projects that need this. I'll post it here once I've polished it, then you can take a look and make sure it all makes sense, if you like. Don't want to misdirect anyone else who might read this thread, that's for sure...

    Many thanks for your help! :slight_smile:

    ea/

  • EA

    Here's how I (finally!) got it all to work as planned:

    1. Download and activate the plugins you’ll need before you start:

    • Gravity Forms (paid plugin)
    • Gravity Forms + Custom Post Types (free plugin)
    • CustomPress (paid plugin)

    Note: If you have other plugins that do some portion of these same functions, such as PODS, or Types, deactivate them. Once you get this recipe working, you might want to delete them completely.

    2. Open CustomPress and add a new custom post type:

    • Select “Add Post Type”
    • CRITICAL STEP: Post Type: Give it a system-friendly name with only lower-case letters and underscores -- choose well as it can’t be changed later
    • CRITICAL STEP: Supports: Make sure you select Title and Custom Fields. After that, choose what you want to be able to do with your new post type, eg add a thumbnail, allow comments, etc.
    • The rest is up to you
    • Save

    3. Now add Custom Fields:

    • Click on the Tab named “Custom Fields”
    • Click on “Add Custom Field”
    • Make sure the names for your new custom fields are all unique and don’t replicate anything you might have created in any other plugin
    • CRITICAL STEP: Always select “Allow for WP/plugins” -- essential for Gravity Forms to be able to connect with your custom fields
    • Choose the Post Type name that matches your new custom post type (you can choose more than one post type that this field will work with, if you want)
    • Save
    • Copy the new field’s slug (under Field ID in the main Custom Fields window)

    4. Create a new Gravity Form:

    • Create a new form especially for your new custom post-type submission form
    • Choose at least the first two of the following default fields from Post Fields (I use all four, and often more): Post Title; Post Body; Post Excerpt; Post Category

    5. Edit the "Properties" details in the Post Title Gravity Form field:

    • Now go back up to the newly-added Post Title form field, click on Edit, and make sure you are on the Properties Tab:
    • If you want a custom name instead of just “Post Title,” change it in the Field Label box
    • Set Post Status to Pending Review (I don’t want people’s submissions to publish until after I’ve viewed them, but “your mileage may vary?”)
    • Decide if this box MUST be filled out or not (I’d suggest yes to ensure the post has a title and you don’t have to take the time to create one) and use the checkbox at the bottom where it says “Rules: Required”

    6. EDIT the Advanced details in the Post Title Gravity Form Field:

    • Click on the Advanced Tab for the Post Title field in Gravity Forms
    • CRITICAL STEP: Select "Save As Post Type" by clicking in the checkbox, and select your new custom post type from the drop-down list
    • The rest is up to you

    6. Review the rest of your standard post entry fields:

    • Post Body and Post Excerpts fields shouldn’t need adjusting unless you want to tweak their titles to fit your post type content
    • Choose which Post Category you want this submission to belong to

    7. Add and set up your custom fields so the entry fields connect to your custom post fields:

    • Click on the Custom button under Post Fields -- you’ll need to add one Post Custom Field box in your Gravity Form for each new custom field you created in CustomPress that you want form users to be able to fill out
    • Click to edit the new Post Custom Field box
    • Give it a suitable (human-friendly) name
    • Choose which type of field it is (e.g. date, text, whatever)

    8. Now you need to connect the Gravity Forms entry field to the correct CustomPress Field Name:

    NOTE: This step is where your new Gravity Forms field will map to your new CustomPress field, but the very first time you use the new field it probably won’t show up here under “existing” even though you’ve already made it in CustomPress! Gravity Forms won’t be able to “see” it at first. Once you’ve “helped” GF “see” it by one of the methods below, it will appear in your list in the future.

    8 a. OPTION ONE (longer but possibly more reliable):

    • Save your form
    • Using the WP admin panel and your newly-created post type manager, add a new custom post, fill in all the fields (dummy text is fine), and publish it
    • Return to your new Gravity Form and go back into the Custom field box
    • Under the Properties Tab, select Custom Field Name: Existing, and your new custom field should now appear in the drop-down list
    • Select the custom post Field ID for the post field you want this entry field in Gravity Forms to map to
    • Update (save) your form

    8 b. OPTION TWO (shorter and easier, but might be less reliable?):

    • Click on the “New” radio button under Custom Field Name
    • Paste the slug (Field ID) for the custom field you want to link this form entry field to in the custom post type
    • Save your form

    9. Test it out:

    • Create a New Page
    • Add the new form you’ve just created, and publish the page
    • Open the page from the front end
    • Fill in the form and submit it
    • Go to your new Custom Post manager and look for the new Pending Post that Gravity Forms should have automatically generated from the form submission
    • You should see it there in the list of posts for that post type; check that the right entry fields map to the right post fields!

    10. If something is wrong, such as the new post doesn’t show up or the fields don’t match correctly, go back and check each step again, especially:

    • Make sure you selected “Allow for WP/Plugins in your custom field options in CustomPress
    • Make sure you selected the right post type in Save As Post Type in your Gravity Form
    • Make sure you pasted the correct Field ID (with no extra spaces before or after) into the Custom Field Name information for each field in Gravity Forms

    11. Displaying your new custom post type content is a different topic!

  • Durty Whyte

    NIIIIIIIIIIIIIIIIIIIIIIIIIIICE :slight_smile: I have the what you call Bootleg version of GravityForms only things not bootleg on mine is stuff from WPMUDEV. Going to be working on Membership Plugin soon and bring in some cash flow that way then any plugin I have like Gravity Forms or themes I have bootlegged will be paid for so when this happens will be useful. None of the themes here catch my eye a few days so probably going with Ultimatum Theme for everything on my sites (minus my modeling site the others right now use bootleg version of Parallelus Salutation Theme which going to pay for aswell. You get your money worth from this site's membership simply to me anyways the plugins alone. So long story short the words above lol thanks for this post cause this will be really really really useful for me im sure in near future #salute kudos.

  • gversion

    Hi,

    Thanks for sharing the instructions for creating a post. Really well documented!

    Once the user has created a post I would like to allow them to edit it. Could anyone explain how to allow the user to edit only the post they created using Gravity Forms and something like, Gravity Forms: Post Updates?

    I need to somehow dynamically pull in the post ID because this will be different for each user.

    Thanks,
    Greg

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.