Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › AjaxSearchPro Events Manager. Double location towns › Reply To: AjaxSearchPro Events Manager. Double location towns
July 2, 2019 at 2:16 pm
#23563
Keymaster
Hi,
I quickly tried WinSCP and Filezilla as well, but unfortunately I am getting the same errors: https://i.imgur.com/zWwNrOm.png
There might be an IP restriction of some sort in effect, as none of my clients can connect. Let me know if you need my IP or any other details.
I can try guessing for other solutions, but as I said earlier, this is a custom work, and I cannot guarantee it will work permanently, in all cases. Try this:
add_filter('asp_pre_get_front_filters', 'asp_locations_pre_get_front_filters', 10, 2);
function asp_locations_pre_get_front_filters($filters, $type) {
if ( $type == 'custom_field' ) {
foreach ( $filters as $k => $filter ) {
if ( $filter->data['field'] == '_location_id' && class_exists('EM_Locations') ) {
$location_ids = array();
foreach ( $filter->get() as $kk=>$item ) {
if ( is_numeric($item->value) ) {
$location_ids[] = $item->value;
}
}
$filter->remove();
$locations = EM_Locations::get( array('location'=>array_unique($location_ids)) );
$locarr = array();
if ( is_array($locations) && count($locations) > 0 ) {
foreach ( $locations as $loc ) {
if ( isset($locarr[$loc->location_town]) ) {
$locarr[$loc->location_town] .= '::' . $loc->location_id;
} else {
$locarr[$loc->location_town] = $loc->location_id;
}
}
ksort($locarr);
foreach ( $locarr as $key => $loc ) {
if ( !empty($key) && !empty($loc) )
$filter->add(
'value' => $loc
'label' => $key
);
}
}
$filters[$k] = $filter;
}
}
}
return $filters;
}
These are only guesses, until I can try, I won’t be able to tell if these work in any way expected.