OK found the BUG and verified it.
I figured out that the difference comes from the fact that some of the browsers were logged in and some weren’t.
Here’s the difference in the two queries.
Logged in:
SELECT wp_em_locations.post_id
FROM wp_em_locations LEFT JOIN wp_em_events
ON wp_em_locations.location_id=wp_em_events.location_id
WHERE (<code>recurrence</code>!=1
OR <code>recurrence</code> IS NULL)
AND ( 3959 * acos( cos( radians(35.967) ) * cos( radians( location_latitude ) ) * cos( radians( location_longitude ) - radians(-83.188) ) + sin( radians(35.967) ) * sin( radians( location_latitude ) ) ) ) < 25
AND (<code>location_status</code>=1 )
GROUP BY wp_em_locations.location_id
ORDER BY location_name ASC
LIMIT 10 OFFSET 0
Logged OUT
SELECT wp_em_locations.post_id
FROM wp_em_locations LEFT JOIN wp_em_events
ON wp_em_locations.location_id=wp_em_events.location_id
WHERE (<code>recurrence</code>!=1
OR <code>recurrence</code> IS NULL)
AND ( 3959 * acos( cos( radians(35.967) ) * cos( radians( location_latitude ) ) * cos( radians( location_longitude ) - radians(-83.188) ) + sin( radians(35.967) ) * sin( radians( location_latitude ) ) ) ) < 25
AND (<code>location_status</code>=1 )
AND (<code>location_private</code>=0
AND <code>event_private</code>=0)
GROUP BY wp_em_locations.location_id
ORDER BY location_name ASC
LIMIT 10 OFFSET 0
The difference is in the two lines
AND (<code>location_private</code>=0
AND <code>event_private</code>=0)
I’ve checked all my records and ALL of them are marked private=0.
So I tried adding
$_REQUEST['private'] = 1;
to the query and this got the correct results! Because this removes the private conditions.
The problem is a BUG where you require the
event_private=1
BUT if that Location does not have any events this fails and the location is hidden even though it is not Private.
You need to ignore event_private on a Location search. Locations should be shown without regard to whether the event is private. Only the Location private should apply.
Hope this helps..