I have a page that displays a particular form. If the user is not logged in, I also display the user registration form at the top of the page:

if (!$user->uid){
   $output .= drupal_get_form("user_register");
}
$output .= drupal_get_form("my_form");

What I would like to do, however, is display the login / create account / retrieve password tabs at the top of the page, if the user is not logged in:

if (!$user->uid){
   $output .= ???; // display the login/create account/retrieve password tabs.
}
$output .= drupal_get_form("my_form");

Does anyone know how to do this?
Thanks,
Mindy

Comments

kovalev’s picture

Inside the theming files page-whatever.tpl.php there is a variable $tabs, which contains the tabs html, you can decide if to display it or not in this file

kobnim’s picture

Thanks for the response. My underlying qustion is about hook_menu. If I want to display the login/register tabs as the full page content then I could do something like:

  $items['my/path/register'] = array(
    'title' => 'Create account',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('user_register'),
    'access callback' => 'user_register_access',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file' => 'user.pages.inc',
  );
  $items['my/path/login'] = array(
    'title' => 'Log in',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('user_login'),
	'access callback' => 'user_is_anonymous',
	'type' => MENU_LOCAL_TASK,
  );

When the user goes to 'my/path', they see both the register and login tab.

But what if I want to display the register and login tabs on just a region of the page, not the full page? Is there a way to specify that I want to display tabs if I cannot use hook_menu? Or is there some sneaky way to use hook_menu to accomplish this?

Thanks very much,
Mindy

kobnim’s picture

Anyone know how to do this? Your help would be greatly appreciated. Thanks.