Support » Plugin: GEO my WordPress » Only certain roles GMW form search results / location tab only on certain roles

  • Kir 2012


    Hi there, I’ve done the research and seen a lot about this but for some reason cannot get any of it working at my site! I’m using leaflet rather than Google Maps, and the most up to date wordpress / gmw plugin etc – here is the code I’m using, can you see what I’m doing wrong? Thank you.

    Code to make only vendor and searcher roles appear in bp member locator searches via gmw form:

    function set_only_vendors_in_gmw_results( $args, $gmw ) {
        $userargs = array('role'=>'vendor','searcher', 'fields'=> 'ID');
        $vendorids = get_users( $userargs);
        if (!empty($vendorids)){
            $vendorids = implode(',',$vendorids);
            $args['include'] = $vendorids;
            return $args;
    add_filter( 'gmw_fl_search_query_args', 'set_only_vendors_in_gmw_results', 10, 2 );

    And code to make locations tab appear only for vendor and searcher roles:

    add_filter( 'gmw_fl_setup_nav', 'rh_remove_location_tab', 10, 1 );
    function rh_remove_location_tab($bp){
        global $bp;
        $userobj = get_userdata($bp->displayed_user->id);
        if ( in_array( 'vendor','searcher', (array) $userobj->roles ) ) {
            return array(
                'name'                => __( 'Location', 'GMW' ),
                'slug'                => GMW_FL_SLUG,
                'position'            => 10,
                'screen_function'     => array($bp->gmw_location, 'screen_functions'),
                'default_subnav_slug' => GMW_FL_SLUG
        else {
Viewing 1 replies (of 1 total)
  • Kir 2012


    Hi just following up on this to see if anyone has any ideas? Thanks 🙂

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.