From efc2fc75c9f55d5cce1a5f90684698d6bf986638 Mon Sep 17 00:00:00 2001 From: dariospace <30393370+dariospace@users.noreply.github.com> Date: Thu, 11 Aug 2022 15:50:19 -0300 Subject: [PATCH 1/3] Update gppa-custom-gf-entry-query-cache.php updated snippet code to match the correct filter --- .../gppa-custom-gf-entry-query-cache.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gp-populate-anything/gppa-custom-gf-entry-query-cache.php b/gp-populate-anything/gppa-custom-gf-entry-query-cache.php index 264ea6f81..4d546cc5f 100644 --- a/gp-populate-anything/gppa-custom-gf-entry-query-cache.php +++ b/gp-populate-anything/gppa-custom-gf-entry-query-cache.php @@ -3,10 +3,17 @@ * Gravity Perks // GP Populate Anything // Custom GF_Entry Query Cache * https://gravitywiz.com/documentation/gravity-forms-populate-anything/ * - * This filter may improve performance but is known to return incorrect results when multiple fields are populated and chained to each other. + * This may improve performance but is known to return incorrect results when multiple fields are populated and chained to each other. */ -// Replace "123" with your form ID and "4" with your field ID. -add_filter( 'gppa_query_limit_123_4', function() { - // Update "1000" to whatever you would like the query limit to be. - return 1000; -} ); +add_filter( 'gppa_query_cache_hash', function( $query_cache_hash, $object_type, $args ) { + if ( $object_type === 'gf_entry' ) { + return sha1( sprintf( '%s-%s-%s-%s-%s', + $args['field']->formId, + json_encode( $args['filter_groups'] ), + json_encode( $args['ordering'] ), + json_encode( $args['primary_property_value'] ), + json_encode( $args['unique'] ) + ) ); + } + return $query_cache_hash; +}, 10, 3 ); From 8a04d3dd7efa37782d827a04231aa8e8838160c5 Mon Sep 17 00:00:00 2001 From: dariospace <30393370+dariospace@users.noreply.github.com> Date: Thu, 11 Aug 2022 15:53:15 -0300 Subject: [PATCH 2/3] Update gppa-custom-gf-entry-query-cache.php --- .../gppa-custom-gf-entry-query-cache.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gp-populate-anything/gppa-custom-gf-entry-query-cache.php b/gp-populate-anything/gppa-custom-gf-entry-query-cache.php index 4d546cc5f..fe949675f 100644 --- a/gp-populate-anything/gppa-custom-gf-entry-query-cache.php +++ b/gp-populate-anything/gppa-custom-gf-entry-query-cache.php @@ -6,14 +6,14 @@ * This may improve performance but is known to return incorrect results when multiple fields are populated and chained to each other. */ add_filter( 'gppa_query_cache_hash', function( $query_cache_hash, $object_type, $args ) { - if ( $object_type === 'gf_entry' ) { - return sha1( sprintf( '%s-%s-%s-%s-%s', - $args['field']->formId, - json_encode( $args['filter_groups'] ), - json_encode( $args['ordering'] ), - json_encode( $args['primary_property_value'] ), - json_encode( $args['unique'] ) - ) ); - } - return $query_cache_hash; + if ( $object_type === 'gf_entry' ) { + return sha1( sprintf( '%s-%s-%s-%s-%s', + $args['field']->formId, + json_encode( $args['filter_groups'] ), + json_encode( $args['ordering'] ), + json_encode( $args['primary_property_value'] ), + json_encode( $args['unique'] ) + ) ); + } + return $query_cache_hash; }, 10, 3 ); From 7d6fe2510d14239ee5712da46c439078f7325f0b Mon Sep 17 00:00:00 2001 From: dariospace <30393370+dariospace@users.noreply.github.com> Date: Thu, 11 Aug 2022 15:55:56 -0300 Subject: [PATCH 3/3] Update gppa-custom-gf-entry-query-cache.php --- .../gppa-custom-gf-entry-query-cache.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gp-populate-anything/gppa-custom-gf-entry-query-cache.php b/gp-populate-anything/gppa-custom-gf-entry-query-cache.php index fe949675f..40902a01e 100644 --- a/gp-populate-anything/gppa-custom-gf-entry-query-cache.php +++ b/gp-populate-anything/gppa-custom-gf-entry-query-cache.php @@ -8,11 +8,11 @@ add_filter( 'gppa_query_cache_hash', function( $query_cache_hash, $object_type, $args ) { if ( $object_type === 'gf_entry' ) { return sha1( sprintf( '%s-%s-%s-%s-%s', - $args['field']->formId, - json_encode( $args['filter_groups'] ), - json_encode( $args['ordering'] ), - json_encode( $args['primary_property_value'] ), - json_encode( $args['unique'] ) + $args['field']->formId, + json_encode( $args['filter_groups'] ), + json_encode( $args['ordering'] ), + json_encode( $args['primary_property_value'] ), + json_encode( $args['unique'] ) ) ); } return $query_cache_hash;