bp_adminbar_account_menu

Output the My Account BuddyBar menu.

Description

(bool|null) bp_adminbar_account_menu(); 

Returns (bool|null)

Returns false on failure.


Usage

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

Defined (1)

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

/bp-core/deprecated/2.1.php  
  1. function bp_adminbar_account_menu() { 
  2. $bp =buddypress); 
  3.  
  4. if ( empty( $bp->bp_nav ) || ! is_user_logged_in() ) { 
  5. return false; 
  6.  
  7. echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">'; 
  8. echo __( 'My Account', buddypress ) . '</a>'; 
  9. echo '<ul>'; 
  10.  
  11. // Loop through each navigation item 
  12. $counter = 0; 
  13. foreach( (array) $bp->bp_nav as $nav_item ) { 
  14. $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 
  15.  
  16. if ( -1 == $nav_item['position'] ) { 
  17. continue; 
  18.  
  19. echo '<li' . $alt . '>'; 
  20. echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>'; 
  21.  
  22. if ( isset( $bp->bp_options_nav[$nav_item['slug']] ) && is_array( $bp->bp_options_nav[$nav_item['slug']] ) ) { 
  23. echo '<ul>'; 
  24. $sub_counter = 0; 
  25.  
  26. foreach( (array) $bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) { 
  27. $link = $subnav_item['link']; 
  28. $name = $subnav_item['name']; 
  29.  
  30. $link = str_replace( bp_displayed_user_domain(), bp_loggedin_user_domain(), $subnav_item['link'] ); 
  31.  
  32. if ( isset( $bp->displayed_user->userdata->user_login ) ) { 
  33. $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] ); 
  34.  
  35. $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : ''; 
  36. echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>'; 
  37. $sub_counter++; 
  38. echo '</ul>'; 
  39.  
  40. echo '</li>'; 
  41.  
  42. $counter++; 
  43.  
  44. $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 
  45.  
  46. echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . wp_logout_url( home_url() ) . '">' . __( 'Log Out', buddypress ) . '</a></li>'; 
  47. echo '</ul>'; 
  48. echo '</li>';