Skip to:
Content
Pages
Categories
Search
Top
Bottom

Excluding a role from appearing in the directory, activity feed, etc


  • echoleaf
    Participant

    @echoleaf

    I have a role called ‘testing’ which is just used for testing purposes. I would like to exclude members with that role from the directory and also prevent all content created by ‘testing’ members from appearing in activity feeds, post archives, etc.

    I check out this 5yo topic and tried replacing this in the member-loop.php:

    <?php while ( bp_members() ) : bp_the_member(); ?>

    with this

    <?php while ( bp_members() ) : bp_the_member();
    $user = new WP_User( bp_get_member_user_id() );
    if ( $user->roles[0] != ‘subscriber’ ) :
    ?>

    That didn’t work. This didn’t work either:

    <?php while ( bp_members() ) : bp_the_member(); ?>
    
    		<?php
           $wp_user = new WP_User( bp_get_member_user_id() );
          if( $wp_user->roles[0] != 'testing' ): ?>

    I’m at a loss as these are the options I found Googling. What is the correct method?

Viewing 21 replies - 1 through 21 (of 21 total)
Viewing 21 replies - 1 through 21 (of 21 total)
  • You must be logged in to reply to this topic.
Skip to toolbar