Groups is working.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 15 Apr 2019 19:38:13 +0000 (15:38 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 15 Apr 2019 19:38:13 +0000 (15:38 -0400)
Comment out testing of groups.

lib/GlmDataAbstract/DataAbstract.php
models/admin/management/index.php
views/admin/management/index.html

index f931a5f..3a0060f 100755 (executable)
@@ -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 );
+        }
     }
 }
index 22604ac..eae247e 100755 (executable)
@@ -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
      *
index 268077d..d3babe0 100755 (executable)
 
         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