bp_admin_bar_my_account_root

Add the secondary BuddyPress area to the my-account menu.

Description

bp_admin_bar_my_account_root(); 

Usage

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

Defined (1)

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

/bp-core/bp-core-adminbar.php  
  1. function bp_admin_bar_my_account_root() { 
  2. global $wp_admin_bar; 
  3.  
  4. // Bail if this is an ajax request. 
  5. if ( !bp_use_wp_admin_bar() || defined( 'DOING_AJAX' ) ) 
  6. return; 
  7.  
  8. // Only add menu for logged in user. 
  9. if ( is_user_logged_in() ) { 
  10.  
  11. // Add secondary parent item for all BuddyPress components. 
  12. $wp_admin_bar->add_menu( array( 
  13. 'parent' => 'my-account',  
  14. 'id' => 'my-account-buddypress',  
  15. 'title' => __( 'My Account', buddypress ),  
  16. 'group' => true,  
  17. 'meta' => array( 
  18. 'class' => 'ab-sub-secondary' 
  19. ) ); 
  20.  
  21. // Remove 'Edit' post link as it's not applicable to BP. 
  22. // Remove when https://core.trac.wordpress.org/ticket/29538 is addressed. 
  23. if ( is_buddypress() ) { 
  24. $wp_admin_bar->remove_node( 'edit' );