How to add a menu tab to a user profile? I want to create an additional tab (dashboard) on my site's user profile page. There is a Homebox module installed and a dashboard was created for users. The dashboard is accessible by user/dashboard. How can I do this? I tried doing it as below:


New module created with name add_menu_tab
In add_menu_tab.module file I wrote as below
I want to create an additional tab (dashboard) on my site's user profile page. There is a homebox module installed and a dashboard was created for users. The dashboard is accessible by user/dashboard. How can I do this? I tried doing it as below:
New module created with name add_menu_tab
In add_menu_tab.module file I wrote as below:


code :

function add_menu_tab_menu() {
     $items['user/dashboard'] = array(
    'title' =&gt; 'Dashboard',
      'type' =&gt; MENU_LOCAL_TASK,
      'weight' =&gt; 7
    );
    return $items;
  }


The menu is still not visible in user profile
What should I do?
You should implement hook_menu_alter() instead of hook_menu.

function add_menu_tab_menu_alter(&amp;$items) {
  $items['user/dashboard']['type'] = MENU_LOCAL_TASK;
}


Then you should clear the cache, at least the menu cache, as Mołot suggested.

There is also another approach using hook_menu_local_tasks_alter(). But the first method is better since it is called only once, after the hook_menu and saved in the database, while the latter is being called each time the local tasks are rendered.