bp_members_admin_bar_my_account_menu

Add the "My Account" menu and all submenus.

Description

bp_members_admin_bar_my_account_menu(); 

Usage

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

Defined (1)

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

/bp-members/bp-members-adminbar.php  
  1. function bp_members_admin_bar_my_account_menu() { 
  2. global $wp_admin_bar; 
  3.  
  4. // Bail if this is an ajax request. 
  5. if ( defined( 'DOING_AJAX' ) ) 
  6. return; 
  7.  
  8. // Logged in user. 
  9. if ( is_user_logged_in() ) { 
  10.  
  11. $bp =buddypress); 
  12.  
  13. // Stored in the global so we can add menus easily later on. 
  14. $bp->my_account_menu_id = 'my-account-buddypress'; 
  15.  
  16. // Create the main 'My Account' menu. 
  17. $wp_admin_bar->add_menu( array( 
  18. 'id' => $bp->my_account_menu_id,  
  19. 'group' => true,  
  20. 'title' => __( 'Edit My Profile', buddypress ),  
  21. 'href' => bp_loggedin_user_domain(),  
  22. 'meta' => array( 
  23. 'class' => 'ab-sub-secondary' 
  24. ) ) ); 
  25.  
  26. // Show login and sign-up links. 
  27. } elseif ( !empty( $wp_admin_bar ) ) { 
  28.  
  29. add_filter( 'show_admin_bar', '__return_true' ); 
  30.  
  31. // Create the main 'My Account' menu. 
  32. $wp_admin_bar->add_menu( array( 
  33. 'id' => 'bp-login',  
  34. 'title' => __( 'Log in', buddypress ),  
  35. 'href' => wp_login_url( bp_get_requested_url() ) 
  36. ) ); 
  37.  
  38. // Sign up. 
  39. if ( bp_get_signup_allowed() ) { 
  40. $wp_admin_bar->add_menu( array( 
  41. 'id' => 'bp-register',  
  42. 'title' => __( 'Register', buddypress ),  
  43. 'href' => bp_get_signup_page() 
  44. ) );