Tagged: adminbar toolbar quicklinks
Hi Brajesh,
I would like to modify the admin-bar quicklinks. The first one (Howdy, username) should go to /members/username (facebook-like to that users activity), the second one next to the avatar (display and username) to /members/username/profile (other words NOT to /edit). That way only the third own called “Edit profile” will go to /edit. That really would make sense for me…
Do you have time to provide code for bp-custom.php to change the behavior of these first two quicklinks in the toolbar?
Thanks, Hans
Hi Hans,
Thank you for asking.
can you please give it a try and let me know if it works as expected?function buddydev_update_myaccount_links( $wp_admin_bar ) { if ( ! is_user_logged_in() ) { return ; } $profile_url = bp_loggedin_user_domain(); $wp_admin_bar->add_menu( array( 'id' => 'my-account', 'href' => $profile_url ) ); $wp_admin_bar->add_menu( array( 'id' => 'user-info', 'href' => $profile_url, ) ); } add_action( 'admin_bar_menu', 'buddydev_update_myaccount_links', 100 );
Looking forward to hear your feedback.
Thank you
BrajeshHi Brajesh,
Thanks for your fast reply. The first one (Howdy, username) is perfect. But the second link, the one right side of the avatar is now also going to users activity but should link to /members/username/profile/
Hi Hans,
I am sorry, I should have read the requirement carefully. Here is the updated codefunction buddydev_update_myaccount_links( $wp_admin_bar ) { if ( ! is_user_logged_in() ) { return ; } $profile_url = bp_loggedin_user_domain(); $wp_admin_bar->add_menu( array( 'id' => 'my-account', 'href' => $profile_url ) ); $wp_admin_bar->add_menu( array( 'id' => 'user-info', 'href' => user_trailingslashit( $profile_url . BP_XPROFILE_SLUG ), ) ); } add_action( 'admin_bar_menu', 'buddydev_update_myaccount_links', 100 );
Please do let me know how it goes? The avatar and the name will point to the profile now.
Absolutely perfect. If somebody would ask me, I would say that should be BuddyPress default…
Thanks, Brajesh
You are welcome Hans. I too believe that this should be by default. May be we should open a ticket for enhancement?
If you open the ticket it will definitely get some attention… 😉
Thank Christopher for taking time to reply. Appreciate it 🙂
PS: I wrote a blog post yesterday to make t available for everyone. Thank you Hans for bringing it 🙂
https://buddydev.com/buddypress/enhancing-my-account-menu-with-buddypress-in-the-adminbar/
The topic ‘ [Resolved] How to modify wp-admin-bar-my-account?’ is closed to new replies.