bp_activity_admin_menu

Add the Activity top-level menu link when viewing single activity item.

Description

(null) bp_activity_admin_menu(); 

Returns (null)

Null if user does not have access to editing functionality.


Usage

  1. if ( !function_exists( 'bp_activity_admin_menu' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-adminbar.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_activity_admin_menu(); 
  7.  

Defined (1)

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

/bp-activity/bp-activity-adminbar.php  
  1. function bp_activity_admin_menu() { 
  2. global $wp_admin_bar; 
  3.  
  4. // Only show if viewing a single activity item. 
  5. if ( ! bp_is_single_activity() ) { 
  6. return; 
  7.  
  8. // Only show this menu to super admins 
  9. if ( ! bp_current_user_can( 'bp_moderate' ) ) { 
  10. return; 
  11.  
  12. $activity_edit_link = add_query_arg( array( 
  13. 'page' => 'bp-activity',  
  14. 'aid' => bp_current_action(),  
  15. 'action' => 'edit' 
  16. ), bp_get_admin_url( 'admin.php' ) ); 
  17.  
  18. // Add the top-level Edit Activity button. 
  19. $wp_admin_bar->add_menu( array( 
  20. 'id' => 'activity-admin',  
  21. 'title' => __( 'Edit Activity', buddypress ),  
  22. 'href' => esc_url( $activity_edit_link ),  
  23. ) );