Hi Tijmen, thank you for your reply. I spent all yesterday and today trying to figure this out – it’s driving me crazy! What you suggested works great. However, generally they’re not logged in. Instead I want them to be able to filter the results by clicking a button.
For example in the default template I’ve added a form with a hidden text field with value 1 and a submit button. If submit is pressed then that will filter all the results with the database value of 1. To filter the results I’ve added a simple modification to wpsl-ajax-functions.php:
$tester = $_POST['listing-filter'];
SELECT *, ( $distance_unit * acos( cos( radians( %s ) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians( %s ) ) + sin( radians( %s ) ) * sin( radians( lat ) ) ) )
AS distance FROM $wpdb->wpsl_stores WHERE active = 1 && user = '$tester'
$sql_part
",
$placeholders
But this does not work, I cannot figure out why – this is where I’ve spent several hours trying to make this work! I’d highly appreciate your help?