How to remove the "My account" link
Categories:
How to remove the "My account" link
This php snippet is useful for customizing the behavior of the "My account" link. Sometimes you want to place a login link in one of the menus. It might be confusing sometimes because after you login, the link won't show as "Logout" but as "My account". This is not ideal so you can use the snippet to make it show as "Logout".
Place this code inside your template.php file.
<?php
/**
* Override the primary links theming and alter the 'My account' menu item.
*/
function phptemplate_links($links_array,$links_class) {
foreach($links_array as $key => $link) {
if ($link['title']=='My account') {
/**
* Use this code if you want to change the 'My account' menu item to a logout menu item.
* Be sure to leave your users some way to get their user page!
*/
//$link['title'] = 'log out';
//$link['href'] = 'logout';
/**
* Use this code if you want to change the text of the 'My account' menu item to the user's username
*/
//global $user;
//$link['title'] = $user->name;
/**
* Use this code if you want to remove the 'My account' menu item altogether.
*/
unset($links_array[$key]);
}
$links_array[$key] = $link;
}
return theme_links($links_array,$links_class);
}
?>- 556 reads
Great snippet. Appreciate
Great snippet. Appreciate this !
The My Account menu item is
The My Account menu item is locked to the navigation menu.
Create a new menu and move everything from the navigation menu to the new menu. Been doing that for years with most of my sites.
Drupal 7 may bring a different way of handling this.
Post new comment