edit profile in menu link
-
Hi guys, so ive followed this function from the bbpress codex webpage…
// Filter wp_nav_menu() to add profile link
add_filter( ‘wp_nav_menu_items’, ‘my_nav_menu_profile_link’ );
function my_nav_menu_profile_link($menu) {
if (!is_user_logged_in())
return $menu;
else
$current_user = wp_get_current_user();
$user=$current_user->display_name;
$profilelink = ‘- Edit Profile
‘;
$menu = $menu . $profilelink;
return $menu;
}Its working great. the problem im having though is if the user has a space in their name it will produce a invalid link.. for example
if the users name was Adam John
the link will be http://www.example/forum/users/adam john/ and it wont work..
any ideas? thank you in advance!
- You must be logged in to reply to this topic.