From 5b1340925948cf12f17b3593c18e47e5c90befac Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 15 Apr 2019 15:38:13 -0400 Subject: [PATCH] Groups is working. Comment out testing of groups. --- lib/GlmDataAbstract/DataAbstract.php | 16 ++++++++++++---- models/admin/management/index.php | 5 +++-- views/admin/management/index.html | 20 ++++++++++---------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/GlmDataAbstract/DataAbstract.php b/lib/GlmDataAbstract/DataAbstract.php index f931a5f8..3a0060fd 100755 --- a/lib/GlmDataAbstract/DataAbstract.php +++ b/lib/GlmDataAbstract/DataAbstract.php @@ -157,6 +157,11 @@ abstract class GlmDataAbstract */ public $groups = array(); + /** + * Array to store previous fields. + */ + public $saveFields = array(); + /** * Group Select * @@ -4222,21 +4227,24 @@ $forEdit = true; foreach ( $this->groupSelect as $groupSelected ) { // Find the group if ( isset( $this->groups[$groupSelected] ) && $this->groups[$groupSelected] ) { - // trigger_error( print_r( $this->groups[$groupSelected], true ), E_USER_NOTICE ); + trigger_error( print_r( $this->groups[$groupSelected], true ), E_USER_NOTICE ); if ( isset( $this->groups[$groupSelected]['fields'] ) && is_array( $this->groups[$groupSelected]['fields'] ) ) { foreach ( $this->groups[$groupSelected]['fields'] as $fieldKey => $field ) { - // trigger_error( print_r( $field, true ), E_USER_NOTICE ); + trigger_error( print_r( $field, true ), E_USER_NOTICE ); $this->fields[] = $this->saveFields[$field['name']]; } } } } + reset( $this->fields ); } } public function restoreFields() { - $this->fields = $this->saveFields; - // $this->saveFields = false; + if ( isset( $this->saveFields ) && is_array( $this->saveFields ) && !empty( $this->saveFields ) ) { + $this->fields = $this->saveFields; + reset( $this->fields ); + } } } diff --git a/models/admin/management/index.php b/models/admin/management/index.php index 22604ac9..eae247ec 100755 --- a/models/admin/management/index.php +++ b/models/admin/management/index.php @@ -14,7 +14,7 @@ */ // Load Members data abstract -require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/settings/dataSettingsGeneral.php' ; +require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/settings/dataSettingsGeneral.php'; /* * This class performs the work for the default action of the "Members" menu @@ -23,8 +23,9 @@ require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/settings/dataSettingsGeneral.p */ class GlmMembersAdmin_management_index extends GlmDataSettingsGeneral { - public $prefixSlugs = array(); + public $prefixSlugs = array(); public $requiredPages = array(); + public $groupSelect = array(); /** * WordPress Database Object * diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 268077d3..d3babe0c 100755 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -643,16 +643,16 @@ jQuery(document).ready(function($) { - console.log( 'glmApiSettings', glmApiSettings.root ); - $.ajax({ - url: glmApiSettings.root + 'glm/v1/settings', - method: 'GET', - beforeSend: function( xhr ) { - xhr.setRequestHeader( 'X-WP-Nonce', glmApiSettings.nonce ); - } - }).done( function( response ){ - console.log( response ); - } ); + // console.log( 'glmApiSettings', glmApiSettings.root ); + // $.ajax({ + // url: glmApiSettings.root + 'glm/v1/settings', + // method: 'GET', + // beforeSend: function( xhr ) { + // xhr.setRequestHeader( 'X-WP-Nonce', glmApiSettings.nonce ); + // } + // }).done( function( response ){ + // console.log( response ); + // } ); /* * Edit area tabs -- 2.17.1