Skip to:
Content
Pages
Categories
Search
Top
Bottom

removing users of certain roles from members-loop

  • Hi guys,

    I want to prevent users with role “admin” and “editor” from the members-loop and only show those with role “subscriber”.. I’ve fought with many different iterations of an if statement checking against “displayed_user” role from within the loop to display members and none seem to work. Here’s the most recent iteration I’ve tried, which also doesn’t work (note that the

  • tag is the parent of all items displayed for each user inside the loop):

    /* $id = bp_displayed_user_id();
    $user = new WP_User( $id );

    if ( $user->has_cap( ‘activate_plugins’) ) :
    {{don’t show this user}}
    elseif ( $user->has_cap( ‘edit_pages’) ) :
    {{don’t show this user}}
    else :
    {{Show the rest of the users}}
    endif

    Has anyone been able to do this successfully? If so, please please gimme the details on how you got it to work.

    Thanks!

    J.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.