Hi,

I'm developing a module and I want to it have it's own tab on the users 'My Account' page. I'll be implementing a form so anything specific will be of great help.

I'm not currently wanting to depend on any other modules and i've not looked into CCK yet. All this must be installable.

Cheers

Comments

3cwebdev’s picture

You want to create a menu_local_task menu item with the same base path as the user's "My Account" page.

function yourmodule_menu() {
  $items = array();
  $items['user/%user/summary'] = array( // the path of your menu item - $user is a token that will be filled with the current user's uid
    'title' => 'My Current Summary', // The name of your tab
    'page callback' => 'ilt_database_summary', // function to call when above path is visited
    'access callback' => TRUE,
    'type' => MENU_LOCAL_TASK, // this makes it a tab-type menu
  );
  return $items;
}
rarebit’s picture

Brilliant...

Yep, that works a treat...

To follow on though, how do I add tabs in the 'Site Administration' page for my module. I've tried using the above example but still get the first page, oops, no, just tried again without a root and it works there too.

admin/settings/bdir/view
admin/settings/bdir/cats

and removed:

admin/settings/bdir

CHEERS

rarebit’s picture

Actually, is there any way to set the weight or order of the tabs. I believe there must since it's currently going 'View', 'Business', 'Edit', etc...

rarebit’s picture

Yes you use:

'weight' => 7,

I found this here:

http://api.drupal.org/api/function/hook_menu/6

ideveloper’s picture

Correct me if I'm wrong, but I think you need to uninstall the custom module and install it again in order to display these tabs. Otherwise they won't show up, at least they didn't on my computer.