I'm trying to create a custom menu that displays a <li></li> when a user is logged in, and not display it when they're not. I have this so far, but it's not working. Does anyone know how to do this properly?
add_filter('wp_nav_menu_items','custom_nav_items',1,2);
function custom_nav_items($menu, $args) {
global $bp;
$args = (array)$args;
if ( $args['theme_location'] != 'primary' )
return $menu;
$customNav = '<li class="menu-item menu-item-type-post_type menu-item-object-page ss-nav-menu-item-5 ss-nav-menu-item-depth-0 ss-nav-menu-reg ss-nav-menu-mega-alignRight customNav"><a href="'. $bp->loggedin_user->domain .'">'. $bp->loggedin_user->fullname .'</a>
<ul class="sub-menu sub-menu-1">
<li class="menu-item menu-item-type-custom menu-item-object-custom ss-nav-menu-item-depth-1"><a href="'. $bp->loggedin_user->domain .'">View Profile</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom ss-nav-menu-item-depth-1"><a href="'. $bp->loggedin_user->domain .'profile/edit/">Edit Profile</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom ss-nav-menu-item-depth-1"><a href="'. $bp->loggedin_user->domain .'settings/">Edit Settings</a></li>'
if ( is_user_logged_in() ) {
'<li class="menu-item menu-item-type-custom menu-item-object-custom ss-nav-menu-item-depth-1"><a href="'. wp_logout_url( bp_get_root_domain() ) .'">Logout</a></li>' }
'<ul>
</li>';
return $menu.$customNav;
}

.to connect the strings after youris_user_logged_in(). To be honest: Try to write cleaner code and use an IDE like PHPStorm, Aptana/Eclipse, etc. Those will show you such typos instantly. – kaiser Sep 26 '12 at 22:59