cyberhobo / wordpress-geo-mashup

Official repository for Geo Mashup, the plugin that makes WordPress into a GeoCMS. Documentation:
https://github.com/cyberhobo/wordpress-geo-mashup/wiki/Getting-Started
63 stars 15 forks source link

geo_mashup_query doesn't work with WP_User_Query #810

Open apolinario opened 6 years ago

apolinario commented 6 years ago

I don't know if this is a bug or a feature request but in my use case I need to list all WordPress users within a radius, but the geo_mashup_query function doesn't seem to work with WP_User_Query function.

This is my code, which returns all users

$args = array(
    'geo_mashup_query' => array(
        'near_lat' => $lat_user,
        'near_lng' => $long_user,
        'radius_km' => 1,
    )   
);

// The Query
$user_query = new WP_User_Query( $args );

// User Loop
if ( ! empty( $user_query->get_results() ) ) {
    foreach ( $user_query->get_results() as $user ) {
        //all users are listed here
    }
}
cyberhobo commented 6 years ago

That might be possible as a new feature. Your current option is the nearby list tag.