Move a filter for the event times into commonHooks
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 4 Oct 2017 17:00:39 +0000 (13:00 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 4 Oct 2017 17:00:39 +0000 (13:00 -0400)
This filter will be needed for the front end also.

setup/adminHooks.php
setup/commonHooks.php

index cc6ba39..6285f8f 100644 (file)
@@ -90,35 +90,6 @@ if ( $memberEventsAllowed ) {
     );
 }
 
-// Add hook to return event recurrences and times data for a specific event ID
-add_filter( 'glm-member-db-events-get-event-times', function( $eventID ){
-
-    // Check for positive integer event ID
-    $eventId = ($eventID-0);
-    if ($eventId == 0) {
-        return $eventID;
-    }
-
-    // Call dedicated model to get event base data
-    require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php';
-    $EventData = new GlmDataEvents($this->wpdb, $this->config);
-    $eventData = $EventData->getEntry($eventId);
-
-    // If we didn't get a good event, just pass on supplied data
-    if (!$eventData) {
-        return $eventId;
-    }
-
-    // Get any schedules and times for this event
-    require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php';
-    $RecurrenceData = new GlmDataEventsRecurrences($this->wpdb, $this->config);
-    $recurrences = $RecurrenceData->getRecurWithTimes($eventId);
-
-    return $recurrences;
-
-} );
-
-
 
 
 /*
index d08c3b1..3d8b2b2 100644 (file)
@@ -26,4 +26,30 @@ add_filter( 'glm-member-db-events-get-event', function( $eventID ){
 
 } );
 
+// Add hook to return event recurrences and times data for a specific event ID
+add_filter( 'glm-member-db-events-get-event-times', function( $eventID ){
 
+    // Check for positive integer event ID
+    $eventId = ($eventID-0);
+    if ($eventId == 0) {
+        return $eventID;
+    }
+
+    // Call dedicated model to get event base data
+    require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php';
+    $EventData = new GlmDataEvents($this->wpdb, $this->config);
+    $eventData = $EventData->getEntry($eventId);
+
+    // If we didn't get a good event, just pass on supplied data
+    if (!$eventData) {
+        return $eventId;
+    }
+
+    // Get any schedules and times for this event
+    require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php';
+    $RecurrenceData = new GlmDataEventsRecurrences($this->wpdb, $this->config);
+    $recurrences = $RecurrenceData->getRecurWithTimes($eventId);
+
+    return $recurrences;
+
+} );