bp_update_activitiy_visibility_selectbox_meta

The BuddyPress Activity Privacy bp update activitiy visibility selectbox meta function.

Description

bp_update_activitiy_visibility_selectbox_meta( $content ); 

Parameters (1)

0. $content
The content.

Usage

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

Defined (1)

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

/includes/bp-activity-privacy-actions.php  
  1. function bp_update_activitiy_visibility_selectbox_meta( $content ) { 
  2. $is_super_admin = is_super_admin(); 
  3. if( ($is_super_admin && bp_ap_is_admin_allowed_to_view_edit_privacy_levels() ) ||  
  4. (bp_activity_user_can_delete() && bp_ap_is_members_allowed_to_edit_privacy_levels() ) ) { 
  5.  
  6. global $bp; 
  7.  
  8. $visibility = bp_activity_get_meta( bp_get_activity_id(), 'activity-privacy' ); 
  9.  
  10. global $bp_activity_privacy; 
  11. $group_id = bp_get_activity_item_id(); 
  12.  
  13. //if is not a group activity or a new blog post 
  14. if( !isset( $group_id ) || $group_id == 0 || 'new_blog_post' == bp_get_activity_type() ) 
  15. $visibility_levels = bp_get_profile_activity_visibility_levels();  
  16. else 
  17. $visibility_levels = bp_get_groups_activity_visibility_levels(); 
  18.  
  19. //sort visibility_levels by position  
  20. uasort ($visibility_levels, 'bp_activity_privacy_cmp_position'); 
  21.  
  22. $html = '<small style="font-size:9px !important;">  · </small><select class="bp-ap-selectbox" autocomplete="off">'; 
  23. foreach ($visibility_levels as $visibility_level) { 
  24. if( $visibility_level["disabled"] ) 
  25. continue; 
  26. $html .= '<option class="fa fa-' . $visibility_level["id"] . '" ' . ( $visibility_level['id'] == $visibility ? " selected='selected'" : '' ) . ' value="' . $visibility_level["id"] . '">' . $visibility_level["label"] . '</option>'; 
  27. $html .= '</select>'; 
  28.  
  29. $html = apply_filters( 'bp_get_update_activitiy_visibility_selectbox', $html ); 
  30. $content .= $html; 
  31. return $content;