Bug Fix for city drop down list
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 28 Jun 2019 20:12:55 +0000 (16:12 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 28 Jun 2019 20:12:55 +0000 (16:12 -0400)
Need to grab cities for member info records that are in sub categories
also.

classes/data/dataCities.php

index 4b8bccc..eef7111 100644 (file)
@@ -251,8 +251,10 @@ class GlmDataCities extends GlmDataAbstract
                 if ( isset( $actionData['request']['category'] ) && $actionData['request']['category'] ) {
                     $where .= " AND MI.id IN (
                         SELECT member_info
-                          FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "category_member_info
-                         WHERE category IN (" .  $actionData['request']['category'] .")
+                          FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "category_member_info M,
+                               " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "categories C
+                         WHERE M.category IN (" .  $actionData['request']['category'] .")
+                            OR (C.parent IN (" .  $actionData['request']['category'] .") AND M.category = C.id )
                     ) ";
                 }
                 if ( isset( $actionData['request']['county-search'] ) && $actionData['request']['county-search'] ) {
@@ -267,6 +269,7 @@ class GlmDataCities extends GlmDataAbstract
             ";
         }
 
+        // echo '<pre>'.print_r($where, true).'</pre>';
         // Get a list of all cities (optionally for active members only)
         $cities = $this->getList( $where, 'name' );