Use the wp_nav_menu_objects filter to access the menu items
I have used this code:
add_filter('wp_nav_menu_objects', 'ad_filter_menu', 10, 2);
function ad_filter_menu($sorted_menu_objects, $args) {
// check for the right menu to rename the menu item from
// here we check for theme location of 'primary-menu'
// alternatively you can check for menu name ($args->menu == 'menu_name')
if ($args->theme_location != 'primary')
return $sorted_menu_objects;
// rename the menu item that has a title of 'Log ind'
if (is_user_logged_in()) {
foreach ($sorted_menu_objects as $key => $menu_object) {
// can also check for $menu_object->url for example
// see all properties to test against:
// print_r($menu_object); die();
if ($menu_object->title == 'Log in') {
$current_user = wp_get_current_user();
$menu_object->title = $current_user->user_login . " - Log out";
$menu_object->url = wp_logout_url();;
}
}
}
return $sorted_menu_objects;
}
Found the basis for that here: Remove a menu item in menu
Obviously you need to change the line
if (is_user_logged_in()) {
to
if( isset($_SESSION['user']) ) {
and you may need to check for additional menu items to change their title and url depending on status (Logged in or out)