Update the apply filters part for member list model.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 10 Apr 2017 18:19:55 +0000 (14:19 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 10 Apr 2017 18:19:55 +0000 (14:19 -0400)
To get the correct whereSep

models/front/members/list.php

index 2ea2c54..778d075 100644 (file)
@@ -171,7 +171,6 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         $nextStart     = false;
         $start         = 1;
         $limit         = $this->config['settings']['list_pagination_count']; // Now this is in management
-
         // Check for URL parameter override of shortcode parameters
         if (isset($_REQUEST['categorySearch'])) {
             $actionData['request']['category-search'] = $_REQUEST['categorySearch'];
@@ -599,6 +598,12 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         } // if doing amenity search
         $amenityData = ( is_array( $amenityData ) ) ? array_filter( $amenityData ) : array();
 
+        $whereParts = apply_filters('glm-member-db-front-search-query', $where);
+        if ( is_array( $whereParts ) && count( $whereParts ) > 0 ) {
+            $where .= $whereSep.implode(" AND ", $whereParts);
+            $whereSep = ' AND ';
+        }
+
         // Only look at active member information where the member is displayable  (access = 20, 30, 40)
         $where .= $whereSep."
             (
@@ -673,7 +678,6 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
             $resultParam = 'list';
         }
 
-        $where = apply_filters('glm-member-db-front-search-query', $where);
 
         /*
          *  Get a current list of members - unless this is a blank start