From d6d777085e1b592c5c8e564902e6457f40c845aa Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 16 Apr 2019 09:32:03 -0400 Subject: [PATCH] Finish the groups setup for dataAbstract and fix clear cache Clear cache wasn't working because the model for management was only allowing one option (submit). DataAbstract class methods now hawe the calls for setting up groups of fields. --- classes/glmPluginSupport.php | 5 +++-- lib/GlmDataAbstract/DataAbstract.php | 9 ++++++++- models/admin/management/index.php | 11 ++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/classes/glmPluginSupport.php b/classes/glmPluginSupport.php index 8c40d803..937f7ebd 100755 --- a/classes/glmPluginSupport.php +++ b/classes/glmPluginSupport.php @@ -549,9 +549,10 @@ function glmClearShortcodeCache() global $wpdb; + $wpdb->show_errors(); // Remove all cache entries from the database - $sql = "DELETE from ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cache;"; - $wpdb->query($sql); + $sql = "DELETE FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cache"; + $wpdb->query( $sql ); return; } diff --git a/lib/GlmDataAbstract/DataAbstract.php b/lib/GlmDataAbstract/DataAbstract.php index 3a0060fd..214346c3 100755 --- a/lib/GlmDataAbstract/DataAbstract.php +++ b/lib/GlmDataAbstract/DataAbstract.php @@ -3255,6 +3255,7 @@ $forEdit = true; */ public function getList( $where = '', $order = '', $fieldVals = true, $idField = 'id', $start = false, $limit = false, $prohibitListOptions = false, $appendSelect = null ) { + $this->selectGroupFields(); // For testing only /* @@ -3395,6 +3396,7 @@ $forEdit = true; ); } + $this->restoreFields(); // Since we're not doing paging, return the list only return $newList; } @@ -3407,7 +3409,6 @@ $forEdit = true; */ public function getEntry($id, $idfield = 'id', $where = 'true', $fieldVals = false) { - $this->selectGroupFields(); // If there's an ID supplied, add that to the query $idWhere = ''; @@ -3596,6 +3597,7 @@ $forEdit = true; */ public function newEntry() { + $this->selectGroupFields(); // Doing processInputData() with operation "n" only gets setup info // such as pick-lists and does not actually process input. $r = $this->processInputData('n'); @@ -3604,6 +3606,7 @@ $forEdit = true; // Check if there's a function to do other checks $r = $this->checkOther($r, 'n'); + $this->restoreFields(); return $r; } @@ -3650,6 +3653,7 @@ $forEdit = true; */ public function insertEntry($store = true, $fieldPrefix = '') { + $this->selectGroupFields(); // Store any input field prefix $this->fieldPrefix = $fieldPrefix; @@ -3691,6 +3695,7 @@ $forEdit = true; } + $this->restoreFields(); return $r; } @@ -3702,6 +3707,7 @@ $forEdit = true; */ public function editEntry($id, $idField = 'id') { + $this->selectGroupFields(); $this->buildFieldsList('g'); $sql = "SELECT $this->select @@ -3718,6 +3724,7 @@ $forEdit = true; // Process individual fields $detail = $this->processOutputData($detail, 'e', true, $id, $idField); + $this->restoreFields(); return $detail; } diff --git a/models/admin/management/index.php b/models/admin/management/index.php index eae247ec..340fe80b 100755 --- a/models/admin/management/index.php +++ b/models/admin/management/index.php @@ -145,9 +145,9 @@ class GlmMembersAdmin_management_index extends GlmDataSettingsGeneral ); } - // Check for submission option + // Check for option $option = ''; - if ( isset( $_REQUEST[ 'option' ] ) && $_REQUEST[ 'option' ] == 'submit' ) { + if ( isset( $_REQUEST[ 'option' ] ) ) { $option = $_REQUEST['option']; } @@ -214,11 +214,12 @@ class GlmMembersAdmin_management_index extends GlmDataSettingsGeneral case 'clearCache': - // Cleaor the shortcode cache. - glmClearShortcodeCache(); - // Try to get the first (should be only) entry for general settings. $generalSettings = $this->editEntry( $id ); + + // Clear the shortcode cache. + glmClearShortcodeCache(); + break; // Default is to get the current settings and display the form -- 2.17.1