Skip to content

Commit b4043b1

Browse files
committed
Pods Gravity Forms Add-On 1.4.1
* Fixed: When syncing multiple entries, the field values were caching and not unique per entry resulting in what appeared to be duplicated content inserts/updates.
1 parent 39fb040 commit b4043b1

5 files changed

Lines changed: 27 additions & 14 deletions

File tree

includes/Pods_GF.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ public function _gf_to_pods_handler( $form, $entry = array() ) {
13801380

13811381
$save_action = 'add';
13821382

1383-
if ( empty( $id ) && ! empty( $entry['id'] ) && ( ! empty( $this->options['update_pod_item'] ) || apply_filters( 'pods_gf_to_pods_update_pod_items', false ) ) ) {
1383+
if ( empty( $id ) && ! empty( $entry['id'] ) && ( ! empty( $this->options['edit'] ) || ! empty( $this->options['update_pod_item'] ) || apply_filters( 'pods_gf_to_pods_update_pod_items', false ) ) ) {
13841384
$item_id = (int) gform_get_meta( $entry['id'], '_pods_item_id' );
13851385
$item_pod = gform_get_meta( $entry['id'], '_pods_item_pod' );
13861386

@@ -3300,14 +3300,18 @@ public static function get_gf_field_value( $value, $params ) {
33003300
$full_field = $gf_field->id;
33013301
}
33023302

3303-
$cache_key = $form['id'] . ':' . $full_field;
3303+
$cache_key = false;
33043304

3305-
if ( ! empty( $field_options['id'] ) ) {
3306-
$cache_key .= ':' . $field_options['id'];
3307-
}
3305+
if ( ! empty( $entry ) ) {
3306+
$cache_key = $form['id'] . ':' . $entry['id'] . ':' . $full_field;
3307+
3308+
if ( ! empty( $field_options['id'] ) ) {
3309+
$cache_key .= ':' . $field_options['id'];
3310+
}
33083311

3309-
if ( isset( $cached_field_value[ $cache_key ] ) ) {
3310-
return $cached_field_value[ $cache_key ]['value'];
3312+
if ( isset( $cached_field_value[ $cache_key ] ) ) {
3313+
return $cached_field_value[ $cache_key ]['value'];
3314+
}
33113315
}
33123316

33133317
if ( null === $value ) {
@@ -3824,9 +3828,11 @@ public static function get_gf_field_value( $value, $params ) {
38243828
$value = GFCommon::replace_variables( $value, $form, $entry );
38253829
}
38263830

3827-
$cached_field_value[ $cache_key ] = array(
3828-
'value' => $value,
3829-
);
3831+
if ( $cache_key ) {
3832+
$cached_field_value[ $cache_key ] = array(
3833+
'value' => $value,
3834+
);
3835+
}
38303836

38313837
return $value;
38323838

includes/Pods_GF_Addon.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,9 @@ public function process_feed( $feed, $entry, $form ) {
908908
}
909909
catch ( Exception $e ) {
910910
// @todo Log something to the form entry
911+
if ( defined( 'WP_CLI' ) ) {
912+
\WP_CLI::warning( 'Feed processing error: ' . $e->getMessage() );
913+
}
911914
}
912915

913916
return null;

includes/Pods_GF_CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function sync( $args, $assoc_args ) {
115115

116116
$paging['offset'] = $entries_counter;
117117

118-
$entries = \GFAPI::get_entries( $form_id, $search_criteria, null, $paging, $total_entries );
118+
$entries = \GFAPI::get_entries( $form_id, $search_criteria, null, $paging );
119119
} while ( $entries );
120120

121121
$progress_bar->finish();

pods-gravity-forms.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Pods Gravity Forms Add-On
44
Plugin URI: https://pods.io/
55
Description: Integration with Gravity Forms (https://www.gravityforms.com/); Provides a UI for mapping a Form's submissions into a Pod
6-
Version: 1.4
6+
Version: 1.4.1
77
Author: Pods Framework Team
88
Author URI: https://pods.io/about/
99
Text Domain: pods-gravity-forms
@@ -30,7 +30,7 @@
3030
* @package Pods\Gravity Forms
3131
*/
3232

33-
define( 'PODS_GF_VERSION', '1.4' );
33+
define( 'PODS_GF_VERSION', '1.4.1' );
3434
define( 'PODS_GF_FILE', __FILE__ );
3535
define( 'PODS_GF_DIR', plugin_dir_path( PODS_GF_FILE ) );
3636
define( 'PODS_GF_URL', plugin_dir_url( PODS_GF_FILE ) );

readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://pods.io/friends-of-pods/
44
Tags: pods, gravity forms, form mapping
55
Requires at least: 4.6
66
Tested up to: 4.9.8
7-
Stable tag: 1.4
7+
Stable tag: 1.4.1
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -114,6 +114,10 @@ function my_column_row_override( $row, $columns, $form, $gf_field, $options, $re
114114

115115
== Changelog ==
116116

117+
= 1.4.1 - October 16th, 2018 =
118+
119+
* Fixed: When syncing multiple entries, the field values were caching and not unique per entry resulting in what appeared to be duplicated content inserts/updates.
120+
117121
= 1.4 - October 16th, 2018 =
118122

119123
* Support: Added support for Gravity Forms 2.3 database tables changes (You may see a warning on the Edit Pod screen but this is a false positive because we cache a list of all tables to transients and it triggers the warning solved by removing those old "rg" tables)

0 commit comments

Comments
 (0)