Add array keys for the summary data, for each plugin
authorLaury GvR <laury@gaslightmedia.com>
Fri, 12 Jul 2019 18:42:59 +0000 (14:42 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 12 Jul 2019 18:42:59 +0000 (14:42 -0400)
setup/routes/dashboard.php

index dd36638..439d8db 100644 (file)
@@ -88,21 +88,28 @@ class GLMA_Dashboard_Rest_Controller
                          // Call to undefined function get_members_summar()
                         //$members = $this->wpdb->get_results( $sql );
 
-                        $summary[] = GLM_MEMBERS_PLUGIN_DB_PREFIX;
 
-                        if ( defined("GLM_MEMBERS_EVENTS_PLUGIN_PATH") ) {
+
+                        //$summary[] = $this->config['addOns'];
+                        //$addons = array("members", "events");
+                        //foreach ($this->config->addOns as $addon) {
+                            //$summary[] = $addon;
+                        //}
+
+
+                        if ( defined("GLM_MEMBERS_PLUGIN_PATH") ) {
                             $members = $this->get_members_summary();
-                            $summary[] = $members;
+                            $summary['members'] = array("members" => $members);
                         }
                         if ( defined("GLM_MEMBERS_EVENTS_PLUGIN_PATH") ) {
                             $events = $this->get_events_summary();
-                            $summary[] = $events;
+                            $summary['events'] = array("events" => $events);
                         }
                         if ( defined("GLM_MEMBERS_COUPONS_PLUGIN_PATH") ) {
-                            $summary[] = $this->get_coupons_summary();
+                            $summary['coupons'] = array("coupons", $this->get_coupons_summary() );
                         }
                         if ( defined("GLM_MEMBERS_PACKAGING_PLUGIN_PATH") ) {
-                            $summary[] = $this->get_packages_summary();
+                            $summary['packaging'] = array("packaging", $this->get_packages_summary() );
                         }
 
                         return rest_ensure_response( array_values( $summary ) );