Reply To: Redirect to member pages – wpadminbar
You have to build a correct url !
Give this snippet a try: (add to child theme’s functions.php or bp-custom.php)
/* add a menu item to WP Toolbar */
function olala() {
global $wp_admin_bar;
/* check if user is logged in and if friend component is activated */
if ( is_user_logged_in() || bp_is_active( 'friends' ) ) :
/* building the slug */
$href = bp_loggedin_user_domain() . '/' . bp_get_friends_slug() . '/';
endif;
/* building the menu */
$wp_admin_bar->add_node( array(
'id' => 'myfriends',
'title' => 'Friends',
'href' => $href
));
}
add_action( 'admin_bar_menu', 'olala', 100 );