View difference between Paste ID: uM1RgNdR and HSpJNLyV
SHOW: | | - or go back to the newest paste.
1
// Filter wp_nav_menu() to add profile link
2
add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
3-
function my_nav_menu_profile_link($menu) { 	
3+
function my_nav_menu_profile_link($menu) {
4
global $bp;
5
$username = $bp->loggedin_user->userdata->display_name; // or 'user_nicename','user_login' 	
6
	if (!is_user_logged_in())
7-
		$profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('Visit your Awesome Profile') . '</a></li>';
7+
8
	else
9
		$profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' .  $username . '</a></li>';
10
		$menu = $menu . $profilelink;
11
		return $menu;
12
}