Skip to content

Commit

Permalink
gpuid-fill-sequence-gaps.php: Updated to use database schema in Gra…
Browse files Browse the repository at this point in the history
…vity Forms 2.3 and newer.
  • Loading branch information
saifsultanc authored Dec 14, 2024
1 parent 6acf0e1 commit e21b59b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gp-unique-id/gpuid-fill-sequence-gaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Check failure on line 19 in gp-unique-id/gpuid-fill-sequence-gaps.php

View workflow job for this annotation

GitHub Actions / PHPCS

Use placeholders and $wpdb->prepare(); found interpolated variable $table_name at 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();
Expand Down

0 comments on commit e21b59b

Please sign in to comment.