PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.21
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.21
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
← All changes | includes/class-form.php +13 -13 1.6.91.6.21 View file →
@@ -139,10 +139,11 @@
139 139 $field['recaptcha_theme'] = isset( $field['recaptcha_theme'] ) ? $field['recaptcha_theme'] : 'light';
140 140 }
141 141
142 142 // Check if meta_key has changed when saving form compared current entries
143 - $field['original_name'] = $field['name'];
144 -
143 + if ( isset( $field['name'] ) ) {
144 + $field['original_name'] = $field['name'];
145 + }
145 146 $form_fields[] = apply_filters( 'weforms-get-form-field', $field, $this->id );
146 147 }
147 148
148 149 $this->form_fields = apply_filters( 'weforms-get-form-fields', $form_fields, $this->id );
@@ -372,11 +373,11 @@
372 373
373 374 /**
374 375 * When a user is editing their form they may change a fields name.
375 376 * This method will loop through existing entries to match the new field names.
376 - *
377 + *
377 378 * @since 1.6.9
378 - *
379 + *
379 380 * @param int $form_id
380 381 * @param array $form_fields
381 382 */
382 383 public function maybe_update_entries( $form_fields ) {
@@ -385,18 +386,18 @@
385 386 foreach ( $changed_fields as $old => $new) {
386 387 $updated_fields = $this->rename_field( $old, $new );
387 388 }
388 389 }
389 -
390 +
390 391 /**
391 392 * When a user is editing their form they may change a fields name.
392 393 * This method will loop through all fields that have changed.
393 - *
394 + *
394 395 * @since 1.6.9
395 - *
396 + *
396 397 * @param int $form_id
397 398 * @param array $form_fields
398 - *
399 + *
399 400 * @return array
400 401 */
401 402 public function get_changed_fields( $form_fields ) {
402 403 $changed_fields = array();
@@ -401,9 +402,8 @@
401 402 public function get_changed_fields( $form_fields ) {
402 403 $changed_fields = array();
403 404 foreach ( $form_fields as $field ) {
404 405 $org_field = $field['original_name'];
405 - error_log("Org Field" . " = " . print_r($org_field,1));
406 406 // All form fields should have an original name.
407 407 if ( empty( $field['original_name'] ) ) {
408 408 continue;
409 409 }
@@ -419,14 +419,14 @@
419 419
420 420 /**
421 421 * When a user changes the field names of a form, the existing entries will need updated.
422 422 * This method will loop through the existing entries and update them will the new names.
423 - *
423 + *
424 424 * @since 1.6.9
425 - *
425 + *
426 426 * @param int $form_id
427 427 * @param array $form_fields
428 - *
428 + *
429 429 * @return array
430 430 */
431 431 public function rename_field ( $old, $new ) {
432 432 global $wpdb;
@@ -432,9 +432,9 @@
432 432 global $wpdb;
433 433
434 434 $entries = weforms_get_form_entries( $this->id );
435 435
436 - foreach ( $entries as $entry ) {
436 + foreach ( $entries as $entry ) {
437 437 $entry_id = $entry->id;
438 438 $values = weforms_get_entry_meta( $entry_id );
439 439 $update_keys = $wpdb->update( $wpdb->weforms_entrymeta, array( 'meta_key' => $new ), array( 'meta_key' => $old, 'weforms_entry_id' => $entry_id ) );
440 440 }