Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Dec 30th, 2012  |  syntax: PHP  |  size: 0.45 KB  |  hits: 43  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }