While you could possibly add a filter to walker_nav_menu_start_el
and have your callback function alter/recreate the menu item according to your needs, I would say the best and easiest solution is to implement you own menu walker, and supply that to wp_nav_menu
. This should help get you started:
class WPSE_90204_Walker extends Walker_Nav_Menu {
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$user_id = get_current_user_id();
$page_id = 1234; // ID of the "magic" page
if ($user_id) {
// Check if menu item links to page
if ($item->object_id == $page_id) {
$item->url = get_author_posts_url($user_id);
}
}
return parent::start_el($output, $item, $depth, $args, $id);
}
}
And then when calling wp_nav_menu
:
wp_nav_menu(array(
// Probably some other args here...
'walker' => new WPSE_90204_Walker,
));
Using this method you can add an ordinary page to you menu. This page will be displayed when the user is not logged in, so you could place a warning message, registration/login form etc. there. If the user is logged in, the walker will compare the object_id (related post) for each menu item, and in case it matches the ID of your page it will point the URL of that menu item to the user profile page.