Updating for events from glm associate.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 13 Oct 2016 20:00:47 +0000 (16:00 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 13 Oct 2016 20:00:47 +0000 (16:00 -0400)
Adding our list of events into the block admin to link our events into
the glm Blocks.

setup/adminHooks.php
setup/frontHooks.php

index ebf4363..8fc019c 100644 (file)
  *
  *  Also note that parameters will be in the context of the main admin controller constructor.
  */
+add_filter( 'glm-member-db-events-get-events', function( $output ){
+    $events = $this->wpdb->get_results(
+        "SELECT E.id,E.name,T1.start_time as start
+           FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events E,
+                " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times T1
+          WHERE E.status = 10
+            AND T1.event = E.id AND T1.start_time IN (SELECT MIN(start_time)
+                                                        FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
+                                                       WHERE event = E.id)
+         ORDER BY start DESC",
+        ARRAY_A
+    );
+    return $events;
+} );
index acd4639..aa48897 100644 (file)
@@ -132,3 +132,11 @@ if (isset($this->config['addOns']['glm-member-db'])) {
     );
 
 }
+
+add_filter( 'glm-member-db-events-get-event-data', function( $event_id ){
+    require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php';
+    $eventData = new GlmDataEvents( $this->wpdb, $this->config );
+    $events    = $eventData->getEntry( $event_id );
+    return $events;
+} );
+