Function Reference: searching_filter_location_where

Summary

Adds the location filter to the where clause.

Package

GeoDirectory_Location_Manager

Parameters

$where
(string) (required) The WHERE clause of the query.

Default: None

Return Values

(string)
  • Filtered WHERE clause.

Change Log

Since: 1.0.0

Source File

searching_filter_location_where() is located in geodir_location_manager/geodir_location_hooks_actions.php [Line: 1437]

Source Code

function searching_filter_location_where($where)
{
	global $table;
	$city_where = '';
	// Filter-Location-Manager // City search ..
	if(isset($_REQUEST['scity']))
	{	
		if(is_array($_REQUEST['scity']) && !empty($_REQUEST['scity']))
		{
			$awhere = array();
			foreach($_REQUEST['scity'] as $city)
			{
				//$city_where .= "'".$city."',";
				//$where .= " FIND_IN_SET(".$_REQUEST['scity'].", post_locations), ";
				$awhere[] = " post_locations LIKE '[".$_REQUEST['scity']."],%' ";
			}
			$where .= " ( " . implode( " OR ", $awhere ) ." ) ";
		}
		elseif($_REQUEST['scity'] != ''){
			//$city_where = "'".$_REQUEST['scity']."'";
			//$where .= " FIND_IN_SET(".$_REQUEST['scity'].", post_locations) ";
			$where .= " post_locations LIKE '[".$_REQUEST['scity']."],%' ";
		}
		
		/*if(!empty($city_where))
			$where .= " AND ".POST_LOCATION_TABLE.".city IN ( ". trim($city_where,',') ." ) ";*/
			
	}	
	return $where ;
}