bp_activity_privacy_latest_update

The BuddyPress Activity Privacy bp activity privacy latest update function.

Description

bp_activity_privacy_latest_update( $latest_update ); 

Parameters (1)

0. $latest_update
The latest update.

Usage

  1. if ( !function_exists( 'bp_activity_privacy_latest_update' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-activity-privacy/includes/bp-activity-privacy-filters.php'; 
  3.  
  4. // The latest update. 
  5. $latest_update = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_activity_privacy_latest_update($latest_update); 
  9.  

Defined (1)

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

/includes/bp-activity-privacy-filters.php  
  1. function bp_activity_privacy_latest_update( $latest_update ) { 
  2. $user_id = bp_displayed_user_id(); 
  3.  
  4. if ( bp_is_user_inactive( $user_id ) ) 
  5. return $latest_update; 
  6.  
  7. if ( !$update = bp_get_user_meta( $user_id, 'bp_latest_update', true ) ) 
  8. return $latest_update; 
  9.  
  10. $activity_id = $update['id']; 
  11. $activity = bp_activity_get_specific( array( 'activity_ids' => $activity_id ) ); 
  12.  
  13. // single out the activity 
  14. $activity_single = $activity["activities"][0]; 
  15.  
  16. $has_activities = false; 
  17. $activities = new stdClass(); 
  18. $activities->activities = array(); 
  19. $activities->activities[] = $activity_single; 
  20.  
  21. bp_visibility_activity_filter( $has_activities, $activities ); 
  22.  
  23. if ( empty( $activities->activities ) ) 
  24. $latest_update = null; 
  25.  
  26. return $latest_update;