Advertisement
Guest User

BP exclude members

a guest
Feb 3rd, 2016
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.52 KB | None | 0 0
  1. <?php
  2. /**
  3.  * BuddyPress - Members Loop
  4.  *
  5.  * Querystring is set via AJAX in _inc/ajax.php - bp_legacy_theme_object_filter()
  6.  *
  7.  * @package BuddyPress
  8.  * @subpackage bp-legacy
  9.  */
  10.  
  11. /**
  12.  * Fires before the display of the members loop.
  13.  *
  14.  * @since 1.2.0
  15.  */
  16. do_action( 'bp_before_members_loop' ); ?>
  17.  
  18. <?php while ( bp_members() ) : bp_the_member();
  19. $user = new WP_User( bp_get_member_user_id() );
  20. if ( $user->roles[0] != ‘testing’ ) :
  21. ?>
  22.  
  23. <?php if ( bp_get_current_member_type() ) : ?>
  24.     <p class="current-member-type"><?php bp_current_member_type_message() ?></p>
  25. <?php endif; ?>
  26.  
  27. <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
  28.  
  29.     <div id="pag-top" class="pagination">
  30.  
  31.         <div class="pag-count" id="member-dir-count-top">
  32.  
  33.             <?php bp_members_pagination_count(); ?>
  34.  
  35.         </div>
  36.  
  37.         <div class="pagination-links" id="member-dir-pag-top">
  38.  
  39.             <?php bp_members_pagination_links(); ?>
  40.  
  41.         </div>
  42.  
  43.     </div>
  44.  
  45.     <?php
  46.  
  47.     /**
  48.      * Fires before the display of the members list.
  49.      *
  50.      * @since 1.1.0
  51.      */
  52.     do_action( 'bp_before_directory_members_list' ); ?>
  53.  
  54.     <ul id="members-list" class="item-list">
  55.  
  56.     <?php while ( bp_members() ) : bp_the_member(); ?>
  57.  
  58.         <?php
  59.       $test_role_array = get_users( array( 'fields' => 'ID', 'role' => 'testing' ) );
  60. $test_role_csv = implode(",", $test_role_array).
  61. $exclude_testing = 'exclude=' . $test_role_csv;
  62.  
  63. if ( bp_has_members( $exclude_testing ) )  // etc
  64.  
  65.         ?>
  66.  
  67.         <li <?php bp_member_class(); ?>>
  68.             <div class="item-avatar">
  69.                 <a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
  70.             </div>
  71.  
  72.             <div class="item">
  73.                 <div class="item-title">
  74.                     <a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
  75.  
  76.                     <?php if ( bp_get_member_latest_update() ) : ?>
  77.  
  78.                         <span class="update"> <?php bp_member_latest_update(); ?></span>
  79.  
  80.                     <?php endif; ?>
  81.  
  82.                 </div>
  83.  
  84.                 <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
  85.  
  86.                 <?php
  87.  
  88.                 /**
  89.                  * Fires inside the display of a directory member item.
  90.                  *
  91.                  * @since 1.1.0
  92.                  */
  93.                 do_action( 'bp_directory_members_item' ); ?>
  94.  
  95.                 <?php
  96.                  /***
  97.                   * If you want to show specific profile fields here you can,
  98.                   * but it'll add an extra query for each member in the loop
  99.                   * (only one regardless of the number of fields you show):
  100.                   *
  101.                   * bp_member_profile_data( 'field=the field name' );
  102.                   */
  103.                 ?>
  104.             </div>
  105.  
  106.             <div class="action">
  107.  
  108.                 <?php
  109.  
  110.                 /**
  111.                  * Fires inside the members action HTML markup to display actions.
  112.                  *
  113.                  * @since 1.1.0
  114.                  */
  115.                 do_action( 'bp_directory_members_actions' ); ?>
  116.  
  117.             </div>
  118.  
  119.             <div class="clear"></div>
  120.         </li>
  121.  
  122.     <?php endwhile; ?>
  123.  
  124.     </ul>
  125.  
  126.     <?php
  127.  
  128.     /**
  129.      * Fires after the display of the members list.
  130.      *
  131.      * @since 1.1.0
  132.      */
  133.     do_action( 'bp_after_directory_members_list' ); ?>
  134.  
  135.     <?php bp_member_hidden_fields(); ?>
  136.  
  137.     <div id="pag-bottom" class="pagination">
  138.  
  139.         <div class="pag-count" id="member-dir-count-bottom">
  140.  
  141.             <?php bp_members_pagination_count(); ?>
  142.  
  143.         </div>
  144.  
  145.         <div class="pagination-links" id="member-dir-pag-bottom">
  146.  
  147.             <?php bp_members_pagination_links(); ?>
  148.  
  149.         </div>
  150.  
  151.     </div>
  152.  
  153. <?php else: ?>
  154.  
  155.     <div id="message" class="info">
  156.         <p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p>
  157.     </div>
  158.  
  159. <?php endif; ?>
  160.  
  161. <?php
  162.  
  163. /**
  164.  * Fires after the display of the members loop.
  165.  *
  166.  * @since 1.2.0
  167.  */
  168. do_action( 'bp_after_members_loop' ); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement