Advertisement
Guest User

Untitled

a guest
Dec 30th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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) {
  4. global $bp;
  5. $username = $bp->loggedin_user->userdata->display_name; // or 'user_nicename','user_login'  
  6.     if (!is_user_logged_in())
  7.         return $menu;
  8.     else
  9.         $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' .  $username . '</a></li>';
  10.         $menu = $menu . $profilelink;
  11.         return $menu;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement