Function Reference: geodir_set_location_var_in_session_autocompleter

Summary

This function has not been documented yet.

Source File

geodir_set_location_var_in_session_autocompleter() is located in geodir_advance_search_filters/geodirectory_advance_search_function.php [Line: 2011]

Source Code

function geodir_set_location_var_in_session_autocompleter($wp){
global $wpdb;
		//$wp->query_vars['page_id'] = get_option('geodir_location_page'); // set page id as location page id
		
		$nLoc = $wpdb->get_row(
							$wpdb->prepare(
								"SELECT * FROM ".POST_LOCATION_TABLE." WHERE location_id= %d LIMIT 1",
                                esc_attr($_REQUEST['set_location_val'])
							)				
						);
		if(is_object($nLoc)){
		
			if($_REQUEST['set_location_type']=='1'){// country
				$wp->query_vars['gd_country']	= $nLoc->country_slug;
				$wp->query_vars['gd_region']	= '';
				$wp->query_vars['gd_city']		= '';
				
			}
			elseif($_REQUEST['set_location_type']=='2'){// country
				$wp->query_vars['gd_country']	= $nLoc->country_slug;
				$wp->query_vars['gd_region']	= $nLoc->region_slug;
				$wp->query_vars['gd_city']		= '';
				
			}
			elseif($_REQUEST['set_location_type']=='3'){// country
				$wp->query_vars['gd_country']	= $nLoc->country_slug;
				$wp->query_vars['gd_region']	= $nLoc->region_slug;
				$wp->query_vars['gd_city']		= $nLoc->city_slug;
				
			}
			
			
			
		}
		//print_r($wp->query_vars);
		//print_r($nLoc);//exit;	
		//print_r($_SESSION);exit;
		return $wp;
}