Redo the featured method for date range search.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 26 Aug 2016 12:08:11 +0000 (08:08 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 26 Aug 2016 12:08:11 +0000 (08:08 -0400)
Need to have the featured events filtered by the date range also.

models/front/events/baseAction.php

index 851e5de..3723bd7 100644 (file)
@@ -159,11 +159,21 @@ abstract class GlmMembersFront_events_baseAction extends GlmDataEvents
     public function getFeaturedEventsData( $featured )
     {
         $this->postAddTimes = true;
+        $where_parts = array();
         if ( $featured ) {
-            $where .= "T.featured = 1";
+            $where_parts[] = "T.featured = 1";
         } else {
             //$where .= "T.featured = 0";
         }
+        $where_parts[] = "T.status = " . $this->config['status_numb']['Active'] . "
+            AND T.id IN (
+                    SELECT event
+                      FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET
+                     WHERE active
+                       AND " . $this->dateRange . "
+                )
+            ";
+        $where = implode( ' AND ', $where_parts );
         $events = $this->getList( $where );
         $this->postAddTimes = false;
         return $events;
@@ -220,12 +230,8 @@ abstract class GlmMembersFront_events_baseAction extends GlmDataEvents
      * @return string
      * @access public
      */
-    function getEventDate(
-        $sdate,
-        $edate,
-        $dateType,
-        $microFormat = false
-    ) {
+    function getEventDate( $sdate, $edate, $dateType, $microFormat = false )
+    {
         switch($dateType) {
             case "Postgres":
             $postgresPattern = "/([0-9]{1,2})[/-]([0-9]{1,2})[/-]([0-9]{4})/";