I am creating a list of all users in wordpress.
For that I am using WP_User_Query with meta_query so that I can show only filtered users.
I am stuck where I want to add a custom query filters in SELECT
p.distance_unit
* DEGREES(ACOS(COS(RADIANS(p.latpoint))
* COS(RADIANS(mt30.meta_value ))
* COS(RADIANS(p.longpoint) - RADIANS(mt31.meta_value))
+ SIN(RADIANS(p.latpoint))
* SIN(RADIANS(mt30.meta_value)))) AS distance
and a custom JOIN
SELECT '.$_REQUEST['user_lat'].' AS latpoint, '.$_REQUEST['user_long'].' AS longpoint,
'.$_REQUEST['geo-radius'].'.0 AS radius, 111.045 AS distance_unit
) AS p ON 1=1
and a custom WHERE condition
AND (mt30.meta_value
BETWEEN p.latpoint - (p.radius / p.distance_unit)
AND p.latpoint + (p.radius / p.distance_unit)
AND mt31.meta_value
BETWEEN p.longpoint - (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint))))
AND p.longpoint + (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint)))))
and custom having clause
having distance < $_REQUEST['geo-radius']
I know that how we add query filters for POSTS but I am not able to add query filters for USERS
Please guide me or any reference url.
Thanks