mute_filter_members_friends

Filter the members loop to show muted friends.

Description

(array) mute_filter_members_friends( (array) $r ); 

Returns (array)

Parameters (1)

0. $r (array)
Arguments for changing the contents of the loop.

Usage

  1. if ( !function_exists( 'mute_filter_members_friends' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-mute/inc/functions.php'; 
  3.  
  4. // Arguments for changing the contents of the loop. 
  5. $r = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = mute_filter_members_friends($r); 
  9.  

Defined (1)

The function is defined in the following location(s).

/inc/functions.php  
  1. function mute_filter_members_friends( $r ) { 
  2.  
  3. if ( ! bp_is_active( 'friends' ) ) { 
  4. return $r; 
  5.  
  6. if ( bp_is_current_component( mute ) && bp_is_current_action( 'friends' ) ) { 
  7.  
  8. // Get an array of muted user IDs. 
  9. $muted_ids = Mute::get_muting( bp_displayed_user_id() ); 
  10.  
  11. foreach ( $muted_ids as $muted_id ) { 
  12.  
  13. // Check if the users are friends. 
  14. $result = friends_check_friendship( bp_displayed_user_id(), $muted_id ); 
  15.  
  16. if ( $result ) { 
  17. $array[] = $muted_id; 
  18.  
  19. if ( empty( $array ) ) { 
  20. $r['include'] = 0; 
  21. } else { 
  22. $r['include'] = $array; 
  23. return $r;