bp_members_admin_bar_my_account_menu()
Add the “My Account” menu and all submenus.
Description
Source
File: bp-members/bp-members-adminbar.php
function bp_members_admin_bar_my_account_menu() { global $wp_admin_bar; // Bail if this is an ajax request. if ( defined( 'DOING_AJAX' ) ) return; // Logged in user. if ( is_user_logged_in() ) { $bp = buddypress(); // Stored in the global so we can add menus easily later on. $bp->my_account_menu_id = 'my-account-buddypress'; // Create the main 'My Account' menu. $wp_admin_bar->add_menu( array( 'id' => $bp->my_account_menu_id, 'group' => true, 'title' => __( 'Edit My Profile', 'buddyboss' ), 'href' => bp_loggedin_user_domain(), 'meta' => array( 'class' => 'ab-sub-secondary' ) ) ); // Show login and sign-up links. } elseif ( !empty( $wp_admin_bar ) ) { add_filter( 'show_admin_bar', '__return_true' ); // Create the main 'My Account' menu. $wp_admin_bar->add_menu( array( 'id' => 'bp-login', 'title' => __( 'Log In', 'buddyboss' ), 'href' => wp_login_url( bp_get_requested_url() ) ) ); // Sign up. if ( bp_get_signup_allowed() ) { $wp_admin_bar->add_menu( array( 'id' => 'bp-register', 'title' => __( 'Register', 'buddyboss' ), 'href' => bp_get_signup_page() ) ); } } }
Changelog
Version | Description |
---|---|
BuddyPress 1.6.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.