Skip to content

Commit

Permalink
Pods Gravity Forms Add-On 1.4.1
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
sc0ttkclark committed Oct 16, 2018
1 parent 39fb040 commit b4043b1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
26 changes: 16 additions & 10 deletions includes/Pods_GF.php
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ public function _gf_to_pods_handler( $form, $entry = array() ) {

$save_action = 'add';

if ( empty( $id ) && ! empty( $entry['id'] ) && ( ! empty( $this->options['update_pod_item'] ) || apply_filters( 'pods_gf_to_pods_update_pod_items', false ) ) ) {
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 ) ) ) {
$item_id = (int) gform_get_meta( $entry['id'], '_pods_item_id' );
$item_pod = gform_get_meta( $entry['id'], '_pods_item_pod' );

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

$cache_key = $form['id'] . ':' . $full_field;
$cache_key = false;

if ( ! empty( $field_options['id'] ) ) {
$cache_key .= ':' . $field_options['id'];
}
if ( ! empty( $entry ) ) {
$cache_key = $form['id'] . ':' . $entry['id'] . ':' . $full_field;

if ( ! empty( $field_options['id'] ) ) {
$cache_key .= ':' . $field_options['id'];
}

if ( isset( $cached_field_value[ $cache_key ] ) ) {
return $cached_field_value[ $cache_key ]['value'];
if ( isset( $cached_field_value[ $cache_key ] ) ) {
return $cached_field_value[ $cache_key ]['value'];
}
}

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

$cached_field_value[ $cache_key ] = array(
'value' => $value,
);
if ( $cache_key ) {
$cached_field_value[ $cache_key ] = array(
'value' => $value,
);
}

return $value;

Expand Down
3 changes: 3 additions & 0 deletions includes/Pods_GF_Addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,9 @@ public function process_feed( $feed, $entry, $form ) {
}
catch ( Exception $e ) {
// @todo Log something to the form entry
if ( defined( 'WP_CLI' ) ) {
\WP_CLI::warning( 'Feed processing error: ' . $e->getMessage() );
}
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion includes/Pods_GF_CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function sync( $args, $assoc_args ) {

$paging['offset'] = $entries_counter;

$entries = \GFAPI::get_entries( $form_id, $search_criteria, null, $paging, $total_entries );
$entries = \GFAPI::get_entries( $form_id, $search_criteria, null, $paging );
} while ( $entries );

$progress_bar->finish();
Expand Down
4 changes: 2 additions & 2 deletions pods-gravity-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Pods Gravity Forms Add-On
Plugin URI: https://pods.io/
Description: Integration with Gravity Forms (https://www.gravityforms.com/); Provides a UI for mapping a Form's submissions into a Pod
Version: 1.4
Version: 1.4.1
Author: Pods Framework Team
Author URI: https://pods.io/about/
Text Domain: pods-gravity-forms
Expand All @@ -30,7 +30,7 @@
* @package Pods\Gravity Forms
*/

define( 'PODS_GF_VERSION', '1.4' );
define( 'PODS_GF_VERSION', '1.4.1' );
define( 'PODS_GF_FILE', __FILE__ );
define( 'PODS_GF_DIR', plugin_dir_path( PODS_GF_FILE ) );
define( 'PODS_GF_URL', plugin_dir_url( PODS_GF_FILE ) );
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://pods.io/friends-of-pods/
Tags: pods, gravity forms, form mapping
Requires at least: 4.6
Tested up to: 4.9.8
Stable tag: 1.4
Stable tag: 1.4.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

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

== Changelog ==

= 1.4.1 - October 16th, 2018 =

* 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.4 - October 16th, 2018 =

* 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)
Expand Down

0 comments on commit b4043b1

Please sign in to comment.