From 5315c11f86c2edff57a3c3654e24e3273a3d059c Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 5 Jul 2017 13:47:49 -0400 Subject: [PATCH] Adding clear options to file and photos Adding a clear data option to the photo and file parts. --- models/admin/import/index.php | 12 ++++++++++++ views/admin/import/files.html | 7 +++++++ views/admin/import/filesValidate.html | 16 +++++++++++++++- views/admin/import/photos.html | 7 +++++++ views/admin/import/photosValidate.html | 17 ++++++++++++++++- 5 files changed, 57 insertions(+), 2 deletions(-) diff --git a/models/admin/import/index.php b/models/admin/import/index.php index 350fac77..d2cb752b 100644 --- a/models/admin/import/index.php +++ b/models/admin/import/index.php @@ -485,6 +485,7 @@ class GlmMembersAdmin_import_index // Set the view file $view = 'photosValidate.html'; $fileData = '
$_FILES: ' . print_r( $_FILES, true ) . '
'; + $clearData = ( filter_var( $_REQUEST['clear_data'], FILTER_VALIDATE_BOOLEAN ) ); break; @@ -504,10 +505,16 @@ class GlmMembersAdmin_import_index // Set the view file $view = 'filesValidate.html'; $fileData = '
$_FILES: ' . print_r( $_FILES, true ) . '
'; + $clearData = ( filter_var( $_REQUEST['clear_data'], FILTER_VALIDATE_BOOLEAN ) ); break; case 'photosProcess': + if ( $clearData ) { + // Empty the tables for the member data. + // Not including the management options. + $this->wpdb->query('DELETE FROM ' . GLM_MEMBERS_PLUGIN_DB_PREFIX . 'images'); + } // Setup the image processing require_once GLM_MEMBERS_PLUGIN_PATH . '/models/admin/ajax/imageUpload.php'; $ImageUpload = new GlmMembersAdmin_ajax_imageUpload($this->wpdb, $this->config); @@ -591,6 +598,11 @@ class GlmMembersAdmin_import_index break; case 'filesProcess': + if ( $clearData ) { + // Empty the tables for the member data. + // Not including the management options. + $this->wpdb->query('DELETE FROM ' . GLM_MEMBERS_PLUGIN_DB_PREFIX . 'files'); + } // Setup the file processing require_once GLM_MEMBERS_PLUGIN_PATH . '/models/admin/ajax/fileUpload.php'; $FileUpload = new GlmMembersAdmin_ajax_fileUpload($this->wpdb, $this->config); diff --git a/views/admin/import/files.html b/views/admin/import/files.html index 87e11ce3..d46a0813 100644 --- a/views/admin/import/files.html +++ b/views/admin/import/files.html @@ -36,6 +36,13 @@ {/foreach} + + Clear Data + + + + + diff --git a/views/admin/import/filesValidate.html b/views/admin/import/filesValidate.html index a340f3ec..04670fbf 100644 --- a/views/admin/import/filesValidate.html +++ b/views/admin/import/filesValidate.html @@ -18,10 +18,24 @@ {/if} + + {if $clearData} + + + All Member Files Data will be cleared before importing any files. + + + {else} + + + No Member Files Data will not be cleared before importing any files. No attempts will be made to prevent duplication of members. + + + {/if} {if $readyToProcess} - Process Files + Process Files {/if} diff --git a/views/admin/import/photos.html b/views/admin/import/photos.html index 7963d812..4e27a831 100644 --- a/views/admin/import/photos.html +++ b/views/admin/import/photos.html @@ -36,6 +36,13 @@ {/foreach} + + Clear Data + + + + + diff --git a/views/admin/import/photosValidate.html b/views/admin/import/photosValidate.html index e8c03e4f..21e8b2d5 100644 --- a/views/admin/import/photosValidate.html +++ b/views/admin/import/photosValidate.html @@ -18,10 +18,25 @@ {/if} + + {if $clearData} + + + All Member Photo Data will be cleared before importing any files. + + + {else} + + + No Member Photo Data will not be cleared before importing any files. No attempts will be made to prevent duplication of members. + + + {/if} + {if $readyToProcess} - Process Photos + Process Photos {/if} -- 2.17.1