• Resolved pasalomoco

    (@pasalomoco)


    I want to make my own account type search filter in the members directory with this logic:

    “Show me members with ‘A’ role but not with ‘B’ role ”

    How can I do this ?

    THX

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @pasalomoco

    Have you tried checking the Member Directory settings to filter which user roles to display in the member directory results? Please go to WP Admin > Ultimate Member > Member Directories > Edit a directory > General Options > see “User Roles to Display”.

    Regards,

    Thread Starter pasalomoco

    (@pasalomoco)

    Yes, i have this but i have a profile with two roles at the same time

    A and B

    I want to filter excluding the accounts with A role but not B role

    • This reply was modified 2 years, 10 months ago by pasalomoco.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @pasalomoco

    Sorry for the late response.

    This requires customization on your end. You can try modifying the following code snippet to display specific user roles to the member directory:

    add_filter("um_prepare_user_query_args","um_011822_show_specific_user_roles");
    function um_011822_show_specific_user_roles( $user_query ){
    
        $user_query['role__in'] = array('my_b_role_slug');
    
        return $user_query;
    }

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @pasalomoco

    ..Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

    Thread Starter pasalomoco

    (@pasalomoco)

    Thanks !

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know.

    Regards,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Exclude roles in search filter’ is closed to new replies.