bp_members_admin_bar_my_account_menu()
Add the “My Account” menu and all submenus.
Description
Source
File: bp-members/bp-members-adminbar.php
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 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.