From e21b59b3c168084b319f94f3545d2a461f1c6296 Mon Sep 17 00:00:00 2001 From: Saif Sultan Date: Sat, 14 Dec 2024 10:20:16 +0530 Subject: [PATCH] `gpuid-fill-sequence-gaps.php`: Updated to use database schema in Gravity Forms 2.3 and newer. --- gp-unique-id/gpuid-fill-sequence-gaps.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gp-unique-id/gpuid-fill-sequence-gaps.php b/gp-unique-id/gpuid-fill-sequence-gaps.php index 42a165de7..bb0dbf6d0 100644 --- a/gp-unique-id/gpuid-fill-sequence-gaps.php +++ b/gp-unique-id/gpuid-fill-sequence-gaps.php @@ -12,16 +12,18 @@ add_filter( 'gpui_sequential_unique_id_pre_insert_519_5', function ( $uid, $form_id, $field_id ) { global $wpdb; + $table_name = GFFormsModel::get_entry_meta_table_name(); + $result = $wpdb->get_results( $wpdb->prepare( " - select value - from {$wpdb->prefix}rg_lead_detail - where form_id = %d and field_number = %d", $form_id, $field_id ) ); + select meta_value + from {$table_name} + where form_id = %d and meta_key = %d", $form_id, $field_id ) ); if ( empty( $result ) ) { return $uid; } - $_uids = wp_list_pluck( $result, 'value' ); + $_uids = wp_list_pluck( $result, 'meta_value' ); $form = GFAPI::get_form( $form_id ); $field = GFFormsModel::get_field( $form, $field_id ); $numbers = array();