Skip to content

Commit

Permalink
Merge pull request #768 from wpdev10/master
Browse files Browse the repository at this point in the history
Delete account field with default key was not deleting column
  • Loading branch information
wpdev10 authored Oct 8, 2024
2 parents 5b5699b + 3ceb4e2 commit 224f1a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions admin/settings/class-formbuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2672,11 +2672,6 @@ public function admin_form_field_delete( $field_id = '', $delete_meta = true, $f
return $field_id;
}

$wpdb->query( $wpdb->prepare( "delete from " . $table_name . " where id= %d AND form_id = %d", array( $cf, $form_id ) ) );

// Also delete register form field
$wpdb->query( $wpdb->prepare( "delete from " . $extras_table_name . " where site_htmlvar_name= %s AND form_id = %d ", array( $field->htmlvar_name, $form_id ) ) );

// delete the meta column
if ( isset($field->htmlvar_name) && $delete_meta ) {
$register_forms = uwp_get_option( 'multiple_registration_forms' );
Expand All @@ -2695,14 +2690,19 @@ public function admin_form_field_delete( $field_id = '', $delete_meta = true, $f
}
}

if(isset($custom_fields) && !empty($custom_fields) && count($custom_fields) > 0){
if(isset($custom_fields) && !empty($custom_fields) && count($custom_fields) > 1){
// Do not delete user meta column if field used in more than one form.
} else {
$col_name = sanitize_sql_orderby( $field->htmlvar_name );
$wpdb->query( "ALTER TABLE `{$meta_table}` DROP COLUMN $col_name" );
$wpdb->query( "ALTER TABLE `{$meta_table}` DROP COLUMN `{$col_name}`" );
}
}

$wpdb->query( $wpdb->prepare( "delete from " . $table_name . " where id= %d AND form_id = %d", array( $cf, $form_id ) ) );

// Also delete register form field
$wpdb->query( $wpdb->prepare( "delete from " . $extras_table_name . " where site_htmlvar_name= %s AND form_id = %d ", array( $field->htmlvar_name, $form_id ) ) );

do_action( 'uwp_after_custom_field_deleted', $cf, $field );

return $field_id;
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Yes, you can customize it with Elementor, but also with Gutenberg, Divi, Beaver

= 1.2.20 - TBD =
* Elementor compatibility error on Events demo site import - FIXED
* Delete account field with default key was not deleting column from our usermeta table - FIXED

= 1.2.19 - 2024-09-06 =
* Theme customize AyeCode UI colors settings not working after update - FIXED
Expand Down

0 comments on commit 224f1a3

Please sign in to comment.