I'd like to expand the "My Account" page to add other tabs, allowing users to access their blog area and read their mail. How do I add tabs to that page? I have Drupal 5.x. Thanks.

Comments

cburschka’s picture

Your new module should implement a hook_menu() function. This hook_menu should return its items with the paths "user/".arg(2)."/email", etc. (arg(2) is always the user id when you are on your user page), and the type MENU_LOCAL_TASK, which renders it as a tab.

Oh, and you'll need to point it to the callback functions that show these pages, of course. http://api.drupal.org/api/5/function/hook_menu has more info.

drupalfan’s picture

Thanks, but I'm a user, not a programmer. I know jstools has a "tabs" module and there are some instructions (http://drupal.org/node/129216), but my question is how do I allow a user to click on one of the new tabs I made and view his or her blog posts? The code in question is below:

$form = array();

$form['example1'] = array(
'#type' => 'tabset',
);
$form['example1']['tab1'] = array(
'#type' => 'tabpage',
'#title' => t('One'),
'#content' => t('First tab content.'),
);
$form['example1']['tab2'] = array(
'#type' => 'tabpage',
'#title' => t('Two'),
'#content' => t('Second tab content.'),
);
$form['example1']['tab3'] = array(
'#type' => 'tabpage',
'#title' => t('Three'),
'#content' => t('Third tab content.'),
);

return tabs_render($form);

Wired Consumers

jbomb’s picture

i think the user id is actually arg(1), so your path would be:

"user/" . arg(1) . "/email"

mooffie’s picture

This question can be asked either from a programmer point of view or from a user's one. I assume you're asking this as a user.

The Views module is a very good solution. It lets you create menu items for your views. And since tabs are a variant of menu items, it lets you create tabs as well.

Note that Views primarily deals with "list of nodes", so I'm not sure about the "read their mail" thingy. But you can put HTML and PHP snippets in the 'header' and 'footer' sections of your view.