By cschults on
Using the function theme_menu_item_link, I'm trying to set the destination for the system logout menu item in navigation, but theme_menu_item_link seems to have no effect.
Here's my code:
function phptemplate_menu_item_link($link) {
if (empty($link['localized_options'])) {
$link['localized_options'] = array();
}
if ($link['href'] == 'logout') {
$link['localized_options']['query'] = 'destination=user';
}
return l($link['title'], $link['href'], $link['localized_options']);
}
Should I be able to modify the logout menu item using this function?
FYI: I tried simply creating a new menu item with a path of "logout&destination=user", but this results in this error:
The path 'logout&destination=user' is either invalid or you do not have access to it.
I suppose I could create my own block to create my own custom logout link, but I was hoping I could use built-in methods instead.
Comments
Typo
Of course, immediately after posting the above I realized a stupid mistake: I'm trying to use "logout&destination=user" instead of "logout?destination=user". D'oh!
However, I'm still curious to about modifying the logout link using the theme_menu_item_link function.