bp_activity_privacy_latest_user_update

The BuddyPress Activity Privacy bp activity privacy latest user update function.

Description

bp_activity_privacy_latest_user_update( $retval, $object_id, $meta_key ); 

Parameters (3)

0. $retval
The retval.
1. $object_id
The object id.
2. $meta_key
The meta key.

Usage

  1. if ( !function_exists( 'bp_activity_privacy_latest_user_update' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-activity-privacy/includes/bp-activity-privacy-filters.php'; 
  3.  
  4. // The retval. 
  5. $retval = null; 
  6.  
  7. // The object id. 
  8. $object_id = null; 
  9.  
  10. // The meta key. 
  11. $meta_key = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_activity_privacy_latest_user_update($retval, $object_id, $meta_key); 
  15.  

Defined (1)

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

/includes/bp-activity-privacy-filters.php  
  1. function bp_activity_privacy_latest_user_update( $retval, $object_id, $meta_key ) { 
  2. if ($meta_key == 'bp_latest_update') { 
  3. remove_filter('get_user_metadata', 'bp_activity_privacy_latest_user_update'); 
  4.  
  5. $is_super_admin = is_super_admin(); 
  6. $bp_displayed_user_id = bp_displayed_user_id(); 
  7. $bp_loggedin_user_id = bp_loggedin_user_id(); 
  8.  
  9. return $retval; 
  10.  
  11. $single = false; 
  12. $retval = get_metadata('user', $object_id, $meta_key, $single); 
  13. if( isset($retval) && is_array($retval) && !empty( $retval) ) { 
  14. $activity_id = $retval[0]['id']; 
  15.  
  16. $activities = bp_activity_get_specific( array( 'activity_ids' => $activity_id ) ); 
  17. $activity = $activities['activities'][0]; 
  18. $remove_from_stream = bp_visibility_is_activity_invisible( $activity, $bp_loggedin_user_id, $is_super_admin, $bp_displayed_user_id ); 
  19. if ($remove_from_stream) { 
  20. return false; 
  21. }  
  22. return $retval; 
  23.