i want login, logout and view profile functionality. i am currently able to login the user and redirect them to home page of website. i want to show loggedin users name on menu and a logout link. for getting username of currently logged user i tried this:http://codex.wordpress.org/Function_Reference/wp_get_current_user but not able to get the username. for login/logout link i used this code in functions.php
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '<li>'. $loginoutlink .'</li>';
return $items;
}
wp_get_current_user
is an object. How are you retrieving username? Please show us proper code.