bp_activity_filter_just_me_scope

Set up activity arguments for use with the 'just-me' scope.

Description

(array) bp_activity_filter_just_me_scope( (array) $retval = array(), (array) $filter = array() ); 

Returns (array)

$retval

Parameters (2)

0. $retval — Optional. (array) => array()
Empty array by default.
1. $filter — Optional. (array) => array()
Current activity arguments.

Usage

  1. if ( !function_exists( 'bp_activity_filter_just_me_scope' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-filters.php'; 
  3.  
  4. // Empty array by default. 
  5. $retval = array(); 
  6.  
  7. // Current activity arguments. 
  8. $filter = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_activity_filter_just_me_scope($retval, $filter); 
  12.  

Defined (1)

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

/bp-activity/bp-activity-filters.php  
  1. function bp_activity_filter_just_me_scope( $retval = array(), $filter = array() ) { 
  2.  
  3. // Determine the user_id. 
  4. if ( ! empty( $filter['user_id'] ) ) { 
  5. $user_id = $filter['user_id']; 
  6. } else { 
  7. $user_id = bp_displayed_user_id() 
  8.  
  9. // Should we show all items regardless of sitewide visibility? 
  10. $show_hidden = array(); 
  11. if ( ! empty( $user_id ) && $user_id !== bp_loggedin_user_id() ) { 
  12. $show_hidden = array( 
  13. 'column' => 'hide_sitewide',  
  14. 'value' => 0 
  15. ); 
  16.  
  17. $retval = array( 
  18. 'relation' => 'AND',  
  19. array( 
  20. 'column' => 'user_id',  
  21. 'value' => $user_id 
  22. ),  
  23. $show_hidden,  
  24.  
  25. // Overrides. 
  26. 'override' => array( 
  27. 'display_comments' => 'stream',  
  28. 'filter' => array( 'user_id' => 0 ),  
  29. 'show_hidden' => true 
  30. ),  
  31. ); 
  32.  
  33. return $retval;