Themergency fooplugins.com

Gravity Forms + Custom Post Types V4 Beta Testers Wanted

| 8 Comments

I have just finished developing the latest version of the free Gravity Forms + Custom Post Types add-on. The current live version (3.0.1) has been “quite” stable for the last couple of months, but I finally got round to implementing some major features that I think users of the plugin will love for sure!

Beta Testers Wanted

The reason for writing this post is that I would like some help from the users of the plugin and the community. Seeing that there are about 12K downloads now and quite a lot of people are writing about it and using it to run their business websites, I think it would be stupid of me to release the next major version into the wild without proper testing. Sure I have tested it myself, but I am a single developer. I have found over the years that the developer tends to “overlook” things when testing his/her own code. So basically I am calling out to get some more eyes and hands on the plugin :)

How To Get It

If you want to download and play with the latest version, simply visit the download page and get it. I would advise people to not install this on their live production sites until the beta testing is complete. Don’t say I didn’t warn you!

New Features

Apart from a semi-rewrite of the plugin, I have also added some cool features. They include:

  • Form entry data now matches saved taxonomies (no more term ids!)
  • You can exclude specific terms and posts from showing
  • Custom filters/hooks to easily extend functionality
  • Better support for custom fields and radio button fields
  • Parent / Child dropdowns (This is my favourite!)

Form Entry Data Cleanup

This is best shown with an example. I have a product custom post type with 4 taxonomies (brands, colours, suppliers & discounts). I created a form that saves the product linking the 4 taxonomies using 4 different field types. In version 3, when I view the form entry after the form is submitted, this is what I see:

Note the useless ID’s shown for Brand, Discounts and Supplier. If you have email notifications enabled, you also get the same in the emails. Now look at V4′s form entry data:

So much better! I can actually see what was chosen for the taxonomy fields. The same info is shown in the emails.

Exclude Terms and Posts

A lot of requests have come in for excluding terms and posts from the dropdowns or checkboxes. I added two textboxes where you can enter a comma seperated list of Id’s you would like to exclude. Here is the terms exclusions:

And here are the post exclusions:

Custom Filters & Hooks

I have added these custom filters for extending the plugin further without needing to edit the code:

  • gfcpt_get_post_args (so you can alter the get_posts arguments)
  • gfcpt_post_filter (filter the posts when populating choices)
  • gfcpt_alter_hierarchical_post (alter the post for hierarchical choices)
  • gfcpt_taxonomy_filter (filter the taxonomies when populating choices)
  • gfcpt_alter_hierarchical_term (alter the term for hierarchical choices)

An example of using the gfcpt_alter_hierarchical_term filter would be to remove the trailing dashes (“–”) for a hierarchical list of taxonomies.

Custom Fields and Radio Button Support

I have improved support for custom fields, as well as radio buttons. You can now use the “Enable other choice” option for the radio button. This means that if you link the field to a taxonomy and the user submitting the form chooses “other” and enters in his custom value, behind the scenes a new taxonomy term will be created. This is what my example form looks like with a radio button field populated by a Suppliers taxonomy:

Then when the form is saved, a Supplier taxonomy term is automatically saved:

Parent /Child Dropdowns

This is the most exciting feature, as I have seen a lot of people trying to get this right in the Gravity Forms forums and elsewhere. You can now create a hierarchical taxonomy, then show the top level items in one dropdown, and then based on the item chosen, it will populate the second dropdown with the child items. Let me explain with an example. I have the following post categories setup:

You then create 2 dropdowns in your form, both populating with the category taxonomy. The first dropdown will be setup like this:

Note the new checkbox for “Only show top level Terms”. This will only show the terms that have no parent. Then add another dropdown and set it up like this:

Check the “Link to parent field” checkbox and some options appear. You then need to supply the ID of the parent field within the form (which you can easily find by hovering over the field in the form editor). You can also supply values to be shown in the dropdown before the parent item is chosen (Unselected Value) and after the parent item is chosen (Default value). This is what the form looks like:

Notice that the child dropdown is disabled and shows the message that was setup above. Select a category and it changes to this:

The second dropdown is populated with the children of the selected item in the first dropdown!

Test Please!

I hope you like the new features and hope you can help me out by testing it. Remember to turn on debugging so you can see any weird php notices. If you find issues or bugs, please drop me a line so I can fix them before I release this into the wild. Thanks!

4 comments
AlexV
AlexV

 @yammy I think he stopped working on this :( 

yammy
yammy

Another similar bug: when I select the parent drowpdown and select any child of it, and submit the form (now both fields are filled), when I submit the form with other empty required fields, the parent value gets remembered, but the child does not, and does not get populated anymore, even when click on parent.

yammy
yammy

I'm testing your plugin. And I found a bug - When you add a parent dropdown with a child dropdown linked to it, using custom post type taxonomy - if you forget to select the parent, and send the form, and the fields are required, you won't be able to have the child behavior populating when click parent, anymore.Please tell me if you have a fix for that. Thanks! 

yammy
yammy

 @AlexV Indeed... He told me he doesn't have time this year  : /