Ninja Forms – The Easy and Powerful Forms Builder - Version 3.4.1

Version Description

(15 January 2019) =

Bugs:

  • Corrected an error that was causing form duplication to fail.
  • Sites with WP_DEBUG enabled should no longer display an undefined 'maintenance' column error on form load.

Changes:

  • Implemented a new import process, which should be more reliable with large form imports.
  • Upgraded our data structure to reduce loading times for forms and the form builder.

=

Download this release

Release Info

Developer krmoorhouse
Plugin Icon 128x128 Ninja Forms – The Easy and Powerful Forms Builder
Version 3.4.1
Comparing to
See all releases

Code changes from version 3.4.0 to 3.4.1

deprecated/ninja-forms.php CHANGED
@@ -265,7 +265,7 @@ class Ninja_Forms {
265
 
266
  // Plugin version
267
  if ( ! defined( 'NF_PLUGIN_VERSION' ) )
268
- define( 'NF_PLUGIN_VERSION', '3.4.0' );
269
 
270
  // Plugin Folder Path
271
  if ( ! defined( 'NF_PLUGIN_DIR' ) )
265
 
266
  // Plugin version
267
  if ( ! defined( 'NF_PLUGIN_VERSION' ) )
268
+ define( 'NF_PLUGIN_VERSION', '3.4.1' );
269
 
270
  // Plugin Folder Path
271
  if ( ! defined( 'NF_PLUGIN_DIR' ) )
includes/Database/Models/Form.php CHANGED
@@ -295,8 +295,8 @@ final class NF_Database_Models_Form extends NF_Abstracts_Model
295
  ));
296
 
297
  // Get our field and field_meta table column names and values.
298
- $fields_sql = self::get_sql_queries( 'field_table_columns' );
299
- $field_meta_sql = self::get_sql_queries( 'field_meta_table_columns' );
300
 
301
  foreach( $old_fields as $old_field ){
302
 
@@ -334,8 +334,8 @@ final class NF_Database_Models_Form extends NF_Abstracts_Model
334
  ));
335
 
336
  // Get our action and action_meta table columns and values.
337
- $actions_sql = self::get_sql_queries( 'action_table_columns' );
338
- $actions_meta_sql = self::get_sql_queries( 'action_meta_table_columns' );
339
 
340
  foreach( $old_actions as $old_action ){
341
  // Duplicate the Action Object.
@@ -433,33 +433,46 @@ final class NF_Database_Models_Form extends NF_Abstracts_Model
433
  );
434
 
435
  // If we haven't been passed a table name or the table name is invalid, return false.
436
- if ( empty( $table_name ) || ! isset( $db_columns[ $table_name ] ) ) return false;
437
 
438
  // If we have not completed stage one of our db update, then we unset new db columns.
439
  if ( ! $db_stage_one_complete ) {
440
- unset(
441
- $field_table_columns[ 'field_label' ],
442
- $field_table_columns[ 'field_key' ],
443
- $field_table_columns[ 'order' ],
444
- $field_table_columns[ 'required' ],
445
- $field_table_columns[ 'default_value' ],
446
- $field_table_columns[ 'label_pos' ],
447
- $field_table_columns[ 'personally_identifiable' ]
448
- );
449
-
450
- unset(
451
- $field_meta_table_columns[ 'meta_key' ],
452
- $field_meta_table_columns[ 'meta_value' ]
453
- );
454
 
455
- unset(
456
- $action_table_columns[ 'label' ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
  );
458
 
459
- unset(
460
- $action_meta_table_columns[ 'meta_key' ],
461
- $action_meta_table_columns[ 'meta_value' ]
 
 
462
  );
 
 
 
 
 
 
 
 
463
  }
464
 
465
  /**
295
  ));
296
 
297
  // Get our field and field_meta table column names and values.
298
+ $fields_sql = self::get_sql_queries( 'field_table_columns', $db_stage_one_complete );
299
+ $field_meta_sql = self::get_sql_queries( 'field_meta_table_columns', $db_stage_one_complete );
300
 
301
  foreach( $old_fields as $old_field ){
302
 
334
  ));
335
 
336
  // Get our action and action_meta table columns and values.
337
+ $actions_sql = self::get_sql_queries( 'action_table_columns', $db_stage_one_complete );
338
+ $actions_meta_sql = self::get_sql_queries( 'action_meta_table_columns', $db_stage_one_complete );
339
 
340
  foreach( $old_actions as $old_action ){
341
  // Duplicate the Action Object.
433
  );
434
 
435
  // If we haven't been passed a table name or the table name is invalid, return false.
436
+ if ( empty( $table_name ) || ! isset( $db_columns[ $table_name ] ) ) {return false;}
437
 
438
  // If we have not completed stage one of our db update, then we unset new db columns.
439
  if ( ! $db_stage_one_complete ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
 
441
+ $db_columns[ 'field_table_columns' ] = array_diff(
442
+ $db_columns[ 'field_table_columns' ],
443
+ array(
444
+ 'field_label',
445
+ 'field_key',
446
+ 'order',
447
+ 'required',
448
+ 'default_value',
449
+ 'label_pos',
450
+ 'personally_identifiable'
451
+ )
452
+ );
453
+
454
+ $db_columns[ 'field_meta_table_columns' ] = array_diff(
455
+ $db_columns[ 'field_meta_table_columns'],
456
+ array(
457
+ 'meta_key',
458
+ 'meta_value'
459
+ )
460
  );
461
 
462
+ $db_columns[ 'action_table_columns' ] = array_diff(
463
+ $db_columns[ 'action_table_columns' ],
464
+ array(
465
+ 'label'
466
+ )
467
  );
468
+
469
+ $db_columns[ 'action_meta_table_columns' ] = array_diff(
470
+ $db_columns[ 'action_meta_table_columns' ],
471
+ array(
472
+ 'meta_key',
473
+ 'meta_value'
474
+ )
475
+ );
476
  }
477
 
478
  /**
includes/Helper.php CHANGED
@@ -445,6 +445,13 @@ final class WPN_Helper
445
  public static function form_in_maintenance( $form_id ) {
446
  global $wpdb;
447
 
 
 
 
 
 
 
 
448
  // Get our maintenance value from the DB and return it at the zero position.
449
  $maintenance = $wpdb->get_row(
450
  "SELECT `maintenance` FROM `{$wpdb->prefix}nf3_upgrades` WHERE `id` = {$form_id}", 'ARRAY_A'
445
  public static function form_in_maintenance( $form_id ) {
446
  global $wpdb;
447
 
448
+ $db_version = get_option( 'ninja_forms_db_version' );
449
+
450
+ if( ! $db_version ) return false;
451
+
452
+ // Exit early if the column doesn't exist.
453
+ if( version_compare( '1.3', $db_version, '>' ) ) return false;
454
+
455
  // Get our maintenance value from the DB and return it at the zero position.
456
  $maintenance = $wpdb->get_row(
457
  "SELECT `maintenance` FROM `{$wpdb->prefix}nf3_upgrades` WHERE `id` = {$form_id}", 'ARRAY_A'
includes/Updates/CacheCollateActions.php CHANGED
@@ -151,6 +151,8 @@ class NF_Updates_CacheCollateActions extends NF_Abstracts_RequiredUpdate
151
  if ( ! $this->debug ) {
152
  // Ensure that our data tables are updated.
153
  $this->migrate( 'cache_collate_actions' );
 
 
154
  }
155
  // Get a list of our forms...
156
  $sql = "SELECT ID FROM `{$this->db->prefix}nf3_forms`";
151
  if ( ! $this->debug ) {
152
  // Ensure that our data tables are updated.
153
  $this->migrate( 'cache_collate_actions' );
154
+ // Set out new db version.
155
+ update_option( 'ninja_forms_db_version', '1.2' );
156
  }
157
  // Get a list of our forms...
158
  $sql = "SELECT ID FROM `{$this->db->prefix}nf3_forms`";
includes/Updates/CacheCollateFields.php CHANGED
@@ -178,6 +178,8 @@ class NF_Updates_CacheCollateFields extends NF_Abstracts_RequiredUpdate
178
  if ( ! $this->debug ) {
179
  // Ensure that our data tables are updated.
180
  $this->migrate( 'cache_collate_fields' );
 
 
181
  }
182
  // Get a list of our forms...
183
  $sql = "SELECT ID FROM `{$this->db->prefix}nf3_forms`";
178
  if ( ! $this->debug ) {
179
  // Ensure that our data tables are updated.
180
  $this->migrate( 'cache_collate_fields' );
181
+ // Set out new db version.
182
+ update_option( 'ninja_forms_db_version', '1.3' );
183
  }
184
  // Get a list of our forms...
185
  $sql = "SELECT ID FROM `{$this->db->prefix}nf3_forms`";
includes/Updates/CacheCollateForms.php CHANGED
@@ -125,6 +125,8 @@ class NF_Updates_CacheCollateForms extends NF_Abstracts_RequiredUpdate
125
  if ( ! $this->debug ) {
126
  // Ensure that our data tables are updated.
127
  $this->migrate( 'cache_collate_forms' );
 
 
128
  }
129
  // Get a list of our forms...
130
  $sql = "SELECT ID FROM `{$this->table}`";
125
  if ( ! $this->debug ) {
126
  // Ensure that our data tables are updated.
127
  $this->migrate( 'cache_collate_forms' );
128
+ // Set out new db version.
129
+ update_option( 'ninja_forms_db_version', '1.1' );
130
  }
131
  // Get a list of our forms...
132
  $sql = "SELECT ID FROM `{$this->table}`";
includes/Updates/CacheCollateObjects.php CHANGED
@@ -132,6 +132,8 @@ class NF_Updates_CacheCollateObjects extends NF_Abstracts_RequiredUpdate
132
  if ( ! $this->debug ) {
133
  // Ensure that our data tables are updated.
134
  $this->migrate( 'cache_collate_objects' );
 
 
135
  }
136
  // Get the number of rows in the objects table.
137
  $sql = "SELECT COUNT( `id` ) as Total FROM `{$this->table}`";
132
  if ( ! $this->debug ) {
133
  // Ensure that our data tables are updated.
134
  $this->migrate( 'cache_collate_objects' );
135
+ // Set out new db version.
136
+ update_option( 'ninja_forms_db_version', '1.4' );
137
  }
138
  // Get the number of rows in the objects table.
139
  $sql = "SELECT COUNT( `id` ) as Total FROM `{$this->table}`";
ninja-forms.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ninja Forms
4
  Plugin URI: http://ninjaforms.com/
5
  Description: Ninja Forms is a webform builder with unparalleled ease of use and features.
6
- Version: 3.4.0
7
  Author: The WP Ninjas
8
  Author URI: http://ninjaforms.com
9
  Text Domain: ninja-forms
@@ -58,7 +58,7 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
58
  * @since 3.0
59
  */
60
 
61
- const VERSION = '3.4.0';
62
 
63
  /**
64
  * @since 3.4.0
3
  Plugin Name: Ninja Forms
4
  Plugin URI: http://ninjaforms.com/
5
  Description: Ninja Forms is a webform builder with unparalleled ease of use and features.
6
+ Version: 3.4.1
7
  Author: The WP Ninjas
8
  Author URI: http://ninjaforms.com
9
  Text Domain: ninja-forms
58
  * @since 3.0
59
  */
60
 
61
+ const VERSION = '3.4.1';
62
 
63
  /**
64
  * @since 3.4.0
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wpninjasllc, kstover, jameslaws, kbjohnson90, klhall1987, krmoorho
3
  Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
4
  Requires at least: 4.8
5
  Tested up to: 5.0
6
- Stable tag: 3.4.0
7
  License: GPLv2 or later
8
 
9
  Drag and drop fields in an intuitive UI to create contact forms, email subscription forms, order forms, payment forms, send emails and more!
@@ -111,7 +111,12 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
111
 
112
  == Upgrade Notice ==
113
 
114
- = 3.4.0 (14 January 2019) =
 
 
 
 
 
115
 
116
  *Changes:*
117
 
@@ -120,6 +125,13 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
120
 
121
  == Changelog ==
122
 
 
 
 
 
 
 
 
123
  = 3.4.0 (14 January 2019) =
124
 
125
  *Changes:*
3
  Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
4
  Requires at least: 4.8
5
  Tested up to: 5.0
6
+ Stable tag: 3.4.1
7
  License: GPLv2 or later
8
 
9
  Drag and drop fields in an intuitive UI to create contact forms, email subscription forms, order forms, payment forms, send emails and more!
111
 
112
  == Upgrade Notice ==
113
 
114
+ = 3.4.1 (15 January 2019) =
115
+
116
+ *Bugs:*
117
+
118
+ * Corrected an error that was causing form duplication to fail.
119
+ * Sites with WP_DEBUG enabled should no longer display an undefined 'maintenance' column error on form load.
120
 
121
  *Changes:*
122
 
125
 
126
  == Changelog ==
127
 
128
+ = 3.4.1 (15 January 2019) =
129
+
130
+ *Bugs:*
131
+
132
+ * Corrected an error that was causing form duplication to fail.
133
+ * Sites with WP_DEBUG enabled should no longer display an undefined 'maintenance' column error on form load.
134
+
135
  = 3.4.0 (14 January 2019) =
136
 
137
  *Changes:*