I want to change Title and breadcrumb for user pages to username
to My Account
.
I don't want to user drupal_set_title
or drupal_set_breadcrumb
bcoz its in lots of pages
I saw below code in user core module
$items['user/%user'] = array(
'title' => 'My account',
'title callback' => 'user_page_title',
'title arguments' => array(1),
'page callback' => 'user_view_page',
'page arguments' => array(1),
'access callback' => 'user_view_access',
'access arguments' => array(1),
// By assigning a different menu name, this item (and all registered child
// paths) are no longer considered as children of 'user'. When accessing the
// user account pages, the preferred menu link that is used to build the
// active trail (breadcrumb) will be found in this menu (unless there is
// more specific link), so the link to 'user' will not be in the breadcrumb.
'menu_name' => 'navigation',
);
/**
* Menu item title callback - use the user name.
*/
function user_page_title($account) {
return is_object($account) ? format_username($account) : '';
}
User menu is calling title callback function and set the user name in that callback function. So i have tried hook_menu_alter
to change title callback of user menu but it is not working
My Code
function health_portal_menu_alter(&$items) {
$items['user/%user']['title callback'] = 'health_portal_user_menu_title';
}
function health_portal_user_menu_title() {
return 'Test';
}
Anybody tell me what is wrong with this code and what i do?
Thanks