Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gfcptaddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Gravity Forms + Custom Post Types
Plugin URI: http://themergency.com/plugins/gravity-forms-custom-post-types/
Description: Allows a simple way to map a Gravity Form post entry to a custom post type. Also include custom taxonomies.
Version: 3.0.1
Version: 3.0.2
Author: Brad Vincent
Author URI: http://themergency.com/
License: GPL2
Expand Down
14 changes: 7 additions & 7 deletions gfcptaddonbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ function get_form_parent_post_id( $form ) {
* setup a field if it is linked to a post type
*/
function setup_post_type_field( &$field, $post_type ) {
$first_choice = $field['choices'][0]['text'];
$field['choices'] = $this->load_post_type_choices( $post_type, $first_choice );
$first_choice = $field->choices[0]['text'];
$field->choices = $this->load_post_type_choices( $post_type, $first_choice );
}

function load_post_type_choices($post_type, $first_choice = '') {
Expand Down Expand Up @@ -298,8 +298,8 @@ function walk_posts( $input_array, $parent_id=0, &$out_array=array(), $level=0 )
* setup a field if it is linked to a taxonomy
*/
function setup_taxonomy_field( &$field, $taxonomy ) {
$first_choice = $field['choices'][0]['text'];
$field['choices'] = $this->load_taxonomy_choices( $taxonomy, $field['type'], $first_choice );
$first_choice = $field->choices[0]['text'];
$field->choices = $this->load_taxonomy_choices( $taxonomy, $field['type'], $first_choice );

//now check if we are dealing with a checkbox list and do some extra magic
if ( $field['type'] == 'checkbox' ) {
Expand All @@ -308,14 +308,14 @@ function setup_taxonomy_field( &$field, $taxonomy ) {

$counter = 0;
//recreate the inputs so they are captured correctly on form submission
foreach( $field['choices'] as $choice ) {
foreach( $field->choices as $choice ) {
$counter++;
if ( ($counter % 10) == 0 ) $counter++; //thanks to Peter Schuster for the help on this fix
$id = floatval( $field['id'] . '.' . $counter );
$inputs[] = array('label' => $choice['text'], 'id' => $id);
}

$field['inputs'] = $inputs;
$field->inputs = $inputs;
}
}

Expand Down Expand Up @@ -404,7 +404,7 @@ function save_taxonomies( $entry, $form ) {
function save_taxonomy_field( &$field, $entry, $taxonomy ) {
if ( array_key_exists( 'type', $field ) && $field['type'] == 'checkbox' ) {
$term_ids = array();
foreach ( $field['inputs'] as $input ) {
foreach ( $field->inputs as $input ) {
$term_id = (int) $entry[ (string) $input['id'] ];
if ( $term_id > 0 )
$term_ids[] = $term_id;
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: bradvin
Donate link: http://themergency.com/donate/
Tags: form,forms,gravity,gravity form,gravity forms,CPT,custom post types,custom post type,taxonomy,taxonomies
Requires at least: 3.0.1
Tested up to: 3.3.1
Tested up to: 4.1.1
Stable tag: 3.0.1

Easily map your forms that create posts to a custom post type. Also map dropdown select, radio buttons list and checkboxes lists to a custom taxonomy.
Expand Down