From: Steve Sutton Date: Wed, 12 Dec 2018 18:18:20 +0000 (-0500) Subject: Updating the city and region list for members. X-Git-Tag: v2.11.0^2~41 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=b4bca88f1d9922d81909444587f6df99c9be7df1;p=WP-Plugins%2Fglm-member-db.git Updating the city and region list for members. Passing in actionData so it can properly retrieve only the needed cities for the shortcode categories. --- diff --git a/classes/data/dataCities.php b/classes/data/dataCities.php index 89347d1c..53d4c183 100644 --- a/classes/data/dataCities.php +++ b/classes/data/dataCities.php @@ -198,7 +198,7 @@ class GlmDataCities extends GlmDataAbstract * @access public */ - public function getListForSearch($forActiveMembers = false) { + public function getListForSearch( $forActiveMembers = false, $actionData = false ) { $where = ''; @@ -214,8 +214,17 @@ class GlmDataCities extends GlmDataAbstract ".$this->config['access_numb']['NoAccess'].", ".$this->config['access_numb']['Moderated'].", ".$this->config['access_numb']['Full']." - ) - ) + )"; + if ( $actionData ) { + 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'] .") + ) "; + } + } + $where .= ") "; } diff --git a/classes/data/dataRegions.php b/classes/data/dataRegions.php index 6e645477..cb3c2466 100644 --- a/classes/data/dataRegions.php +++ b/classes/data/dataRegions.php @@ -153,7 +153,7 @@ class GlmDataRegions extends GlmDataAbstract * @access public */ - public function getListForSearch($forActiveMembers = false) { + public function getListForSearch( $forActiveMembers = false, $actionData = false ) { $where = ''; @@ -169,8 +169,17 @@ class GlmDataRegions extends GlmDataAbstract ".$this->config['access_numb']['NoAccess'].", ".$this->config['access_numb']['Moderated'].", ".$this->config['access_numb']['Full']." - ) - ) + )"; + if ( $actionData ) { + 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'] .") + ) "; + } + } + $where .= ") "; } @@ -184,4 +193,4 @@ class GlmDataRegions extends GlmDataAbstract } -?> \ No newline at end of file +?> diff --git a/models/front/members/list.php b/models/front/members/list.php index 5d6a0d6c..2208add5 100755 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -323,12 +323,12 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo // Get regions for possible use in search pick list for regions used in active member info records. require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php'; $Regions = new GlmDataRegions($this->wpdb, $this->config); - $regionData = $Regions->getListForSearch(true); + $regionData = $Regions->getListForSearch(true, $actionData); // Get cities for possible use in search pick list for cities used in active member info records. require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'; $cities = new GlmDataCities($this->wpdb, $this->config); - $cityData = $cities->getListForSearch(true); // Get only categories that are used in active member data + $cityData = $cities->getListForSearch(true, $actionData); // Get only categories that are used in active member data // If we have a region set in shortcode or via URL.