}
}
-//add_filter('glm-member-db-front-search-query', function( $queryParts ) {
-// //$queryParts = array();
-// if ( isset( $_REQUEST['manufacturers'] ) && is_array( $_REQUEST['manufacturers'] ) && !empty( $_REQUEST['manufacturers'] ) ) {
-// $catSelectedForQuery = implode( ',', $_REQUEST['manufacturers'] );
-// $queryParts[] = " T.id in (
-// SELECT DISTINCT(member_info)
-// FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info M,
-// ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C
-// WHERE M.category in($catSelectedForQuery)
-// OR (C.parent in($catSelectedForQuery) AND M.category = C.id)
-// ) ";
-// }
-// // Check to see if Pre-Owned is not set. If it is not set then only get
-// // listings without the Pre-Owned
-// if ( !isset( $_REQUEST['pre_owned'] ) ) {
-// $queryParts[] = " T.id IN (
-// SELECT ref_dest
-// FROM " . GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_field_data
-// WHERE field_data != 'Yes'
-// AND field_id = (SELECT id
-// FROM " . GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_fields
-// WHERE field_name = 'Pre-Owned')
-// ) ";
-// }
-// return $queryParts;
-//});
+add_filter('glm-member-db-front-search-query', function( $queryParts ) {
+ //$queryParts = array();
+ if ( isset( $_REQUEST['categories'] ) && is_array( $_REQUEST['categories'] ) && !empty( $_REQUEST['categories'] ) ) {
+
+ $catSelectedForQuery = implode( ',',array_filter( $_REQUEST['categories'] ));
+ $queryParts[] = " T.id in (
+ SELECT DISTINCT(member_info)
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info M,
+ ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C
+ WHERE M.category in($catSelectedForQuery)
+ OR (C.parent in($catSelectedForQuery) AND M.category = C.id)
+ ) ";
+ }
+ if ( isset( $_REQUEST['cities'] ) && is_array( $_REQUEST['cities'] ) && !empty( $_REQUEST['cities'] ) && $_REQUEST['cities'][0] !== '' ) {
+
+ $catSelectedForQuery = implode( ',',array_filter( $_REQUEST['cities'] ));
+ $queryParts[] = " T.id in (
+ SELECT DISTINCT(member)
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info M
+ WHERE M.city = $catSelectedForQuery
+ ) ";
+ }
+ if ( isset( $_REQUEST['counties'] ) && is_array( $_REQUEST['counties'] ) && !empty( $_REQUEST['counties'] ) && $_REQUEST['counties'][0] !== '' ) {
+ print_r($_REQUEST['counties']);
+ $catSelectedForQuery = implode( ',',array_filter( $_REQUEST['counties'] ));
+ $queryParts[] = " T.id in (
+ SELECT DISTINCT(member)
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info M
+ WHERE M.county = $catSelectedForQuery
+ ) ";
+ }
+ return $queryParts;
+});
/**
* Return the client info option for the given key
*
</form>
<form action="<?php echo get_permalink(get_option("glm_members_database_option_members_list_id")); ?>?action='list'">
<span>Search by Location</span>
- <select class="header-search" name="" id="region-search">
+ <select class="header-search" name="regionUserSearch[]" id="region-search">
<option value="">Select a Region</option>
<?php foreach($regions as $region){ ?>
<option value="<?php echo $region['region']; ?>"><?php echo $region['name']; ?></option>
<?php } ?>
</select>
- <select class="header-search" name="" id="county-search">
+ <select class="header-search" name="counties[]" id="county-search">
<option value="">Select a County</option>
<?php foreach($counties as $county){ ?>
<option value="<?php echo $county['county']; ?>"><?php echo $county['name']; ?></option>
<?php } ?>
</select>
- <select class="header-search" class="header-search" name="" id="city-search">
+ <select class="header-search" class="header-search" name="cities[]" id="city-search">
<option value="">Select a City</option>
<?php foreach($cities as $city){ ?>
<option value="<?php echo $city['city']; ?>"><?php echo $city['name']; ?></option>
</form>
<form>
<span>Search by</span>
- <select class="header-search" name="" id="destination-search">
+ <select class="header-search" name="categories[]" id="destination-search">
<option value="">Select a Destination</option>
<?php foreach($destinations as $destination){ ?>
<option value="<?php echo $destination['category']; ?>"><?php echo $destination['name']; ?></option>
<?php } ?>
</select>
- <select class="header-search" name="" id="activity-search">
+ <select class="header-search" name="categories[]" id="activity-search">
<option value="">Select an Activity</option>
<?php foreach($activities as $activity){ ?>
<option value="<?php echo $activity['category']; ?>"><?php echo $activity['name']; ?></option>
<?php } ?>
</select>
- <select class="header-search" name="" id="park-search">
+ <select class="header-search" name="categories[]" id="park-search">
<option value="">Select a Park</option>
<?php foreach($parks as $park){ ?>
<option value="<?php echo $park['category']; ?>"><?php echo $park['name']; ?></option>