bp_update_activitiy_visibility_selectbox

The BuddyPress Activity Privacy bp update activitiy visibility selectbox function.

Description

bp_update_activitiy_visibility_selectbox( $content ); 

Parameters (1)

0. $content
The content.

Usage

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