bp_add_visibility_to_group_activity

Add visibility level to group activity meta.

Description

bp_add_visibility_to_group_activity( ([type]) $content, ([type]) $user_id, ([type]) $group_id, ([type]) $activity_id ); 

Parameters (4)

0. $content ([type])
[description]
1. $user_id ([type])
[description]
2. $group_id ([type])
The group id.
3. $activity_id ([type])
The activity id.

Usage

  1. if ( !function_exists( 'bp_add_visibility_to_group_activity' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-activity-privacy/includes/bp-activity-privacy-actions.php'; 
  3.  
  4. // [description] 
  5. $content = null; 
  6.  
  7. // [description] 
  8. $user_id = null; 
  9.  
  10. // The group id. 
  11. $group_id = null; 
  12.  
  13. // The activity id. 
  14. $activity_id = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bp_add_visibility_to_group_activity($content, $user_id, $group_id, $activity_id); 
  18.  

Defined (1)

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

/includes/bp-activity-privacy-actions.php  
  1. function bp_add_visibility_to_group_activity( $content, $user_id, $group_id, $activity_id ) { 
  2. $visibility = 'public'; 
  3.  
  4. if( isset( $_POST['visibility'] ) && in_array( esc_attr( $_POST['visibility'] ), $levels ) ) 
  5. $visibility = esc_attr($_POST['visibility']); 
  6.  
  7. bp_activity_update_meta( $activity_id, 'activity-privacy', $visibility );