Gravity Forms + Custom Post Types - Version 3.1.27

Version Description

  • Fixed an issue where term names were not displayed for multi-value fields like Checkboxes and Multi-selects in the Entry List and Entry Detail views.
Download this release

Release Info

Developer claygriffiths
Plugin Icon wp plugin Gravity Forms + Custom Post Types
Version 3.1.27
Comparing to
See all releases

Code changes from version 3.1.26 to 3.1.27

Files changed (3) hide show
  1. gfcptaddon.php +2 -2
  2. gfcptaddonbase.php +26 -6
  3. readme.txt +3 -0
gfcptaddon.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Gravity Forms + Custom Post Types
4
  Plugin URI: https://gravitywiz.com/
5
  Description: Map your Gravity-Forms-generated posts to a custom post type and/or custom taxonomies.
6
- Version: 3.1.26
7
  Author: Gravity Wiz
8
  Author URI: https://gravitywiz.com/
9
  License: GPL2
@@ -16,7 +16,7 @@ class GFCPTAddon {
16
 
17
  private static $name = 'Gravity Forms + Custom Post Types';
18
  private static $slug = 'GFCPTAddon';
19
- private static $version = '3.1.26';
20
  private static $min_gravityforms_version = '1.9.3';
21
 
22
  //Plugin starting point. Will load appropriate files
3
  Plugin Name: Gravity Forms + Custom Post Types
4
  Plugin URI: https://gravitywiz.com/
5
  Description: Map your Gravity-Forms-generated posts to a custom post type and/or custom taxonomies.
6
+ Version: 3.1.27
7
  Author: Gravity Wiz
8
  Author URI: https://gravitywiz.com/
9
  License: GPL2
16
 
17
  private static $name = 'Gravity Forms + Custom Post Types';
18
  private static $slug = 'GFCPTAddon';
19
+ private static $version = '3.1.27';
20
  private static $min_gravityforms_version = '1.9.3';
21
 
22
  //Plugin starting point. Will load appropriate files
gfcptaddonbase.php CHANGED
@@ -441,7 +441,7 @@ if ( ! class_exists( 'GFCPTAddonBase' ) ) {
441
  $terms = get_terms( $args );
442
  }
443
 
444
- if ( ! array_key_exists( "errors", $terms ) ) {
445
  foreach ( $terms as $term ) {
446
  $choices[] = array( 'value' => $term->term_id, 'text' => $term->name );
447
  }
@@ -592,22 +592,42 @@ if ( ! class_exists( 'GFCPTAddonBase' ) ) {
592
  return $return;
593
  }
594
 
 
 
 
 
 
 
 
 
595
  function display_term_name_on_entry_detail( $value, $field, $entry, $form ) {
 
 
 
 
 
 
 
 
 
 
 
 
596
  return $this->get_term_name( $value, $field );
597
  }
598
 
599
- function display_term_name_on_entry_list( $value, $form_id, $field_id ) {
600
 
601
  if ( is_numeric( $field_id ) ) {
602
- $field = GFFormsModel::get_field( GFAPI::get_form( $form_id ), $field_id );
603
- $value = $this->get_term_name( $value, $field );
604
  }
605
 
606
  return $value;
607
  }
608
 
609
- function display_term_name_on_export( $value, $form_id, $field_id ) {
610
- return $this->display_term_name_on_entry_list( $value, $form_id, $field_id );
611
  }
612
 
613
  function get_post_title( $post_id, $field ) {
441
  $terms = get_terms( $args );
442
  }
443
 
444
+ if ( ! isset( $terms->errors ) ) {
445
  foreach ( $terms as $term ) {
446
  $choices[] = array( 'value' => $term->term_id, 'text' => $term->name );
447
  }
592
  return $return;
593
  }
594
 
595
+ /**
596
+ * @param $value
597
+ * @param \GF_Field $field
598
+ * @param $entry
599
+ * @param $form
600
+ *
601
+ * @return mixed|string
602
+ */
603
  function display_term_name_on_entry_detail( $value, $field, $entry, $form ) {
604
+
605
+ if ( $field->populateTaxonomy && in_array( $field->get_input_type(), array( 'checkbox', 'multiselect' ) ) ) {
606
+ $values = GFFormsModel::get_lead_field_value( $entry, $field );
607
+ if ( $field->get_input_type() === 'multiselect' ) {
608
+ $values = json_decode( $values );
609
+ }
610
+ foreach ( $values as &$_value ) {
611
+ $_value = $this->get_term_name( $_value, $field );
612
+ }
613
+ return $field->get_value_entry_detail( $values );
614
+ }
615
+
616
  return $this->get_term_name( $value, $field );
617
  }
618
 
619
+ function display_term_name_on_entry_list( $value, $form_id, $field_id, $entry = null ) {
620
 
621
  if ( is_numeric( $field_id ) ) {
622
+ $form = GFAPI::get_form( $form_id );
623
+ $value = $this->display_term_name_on_entry_detail( $value, GFAPI::get_field( $form, $field_id ), $entry, $form );
624
  }
625
 
626
  return $value;
627
  }
628
 
629
+ function display_term_name_on_export( $value, $form_id, $field_id, $entry = null ) {
630
+ return $this->display_term_name_on_entry_list( $value, $form_id, $field_id, $entry );
631
  }
632
 
633
  function get_post_title( $post_id, $field ) {
readme.txt CHANGED
@@ -81,6 +81,9 @@ When populating a Drop Down field with a post type, you may wish to set the sele
81
 
82
  == Changelog ==
83
 
 
 
 
84
  = 3.1.26 =
85
  * Updated "Tested up to" to WordPress 5.9.
86
 
81
 
82
  == Changelog ==
83
 
84
+ = 3.1.27 =
85
+ * Fixed an issue where term names were not displayed for multi-value fields like Checkboxes and Multi-selects in the Entry List and Entry Detail views.
86
+
87
  = 3.1.26 =
88
  * Updated "Tested up to" to WordPress 5.9.
89