Created
February 8, 2018 16:57
-
-
Save jaredatch/d368c1a243c14a3f10cbb5c2f9754d56 to your computer and use it in GitHub Desktop.
Revisions
-
jaredatch created this gist
Feb 8, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ <?php /** * Manually run the v1.4.3 entries upgrade routine. * */ function wpf_v143_upgrade_manual() { // Fetch all entries. $entries = wpforms()->entry->get_entries( array( 'number' => -1, 'order' => 'ASC', ) ); // Loop through the entries and add each field value to the new entry // fields database table. if ( ! empty( $entries ) ) { foreach ( $entries as $entry ) { $fields = wpforms_decode( $entry->fields ); if ( ! empty( $fields ) ) { foreach ( $fields as $field ) { if ( isset( $field['id'] ) && isset( $field['value'] ) && '' !== $field['value'] ) { wpforms()->entry_fields->add( array( 'entry_id' => absint( $entry->entry_id ), 'form_id' => absint( $entry->form_id ), 'field_id' => absint( $field['id'] ), 'value' => $field['value'], 'date' => $entry->date, ) ); } } } } } delete_option( 'wpforms_fields_update' ); }