We all know about Drupal primary and secondary tabs, but now you need to have a "third level" tabs.

Is it even possible with Drupal 6? What Drupal doesn't exactly let its user know that with the current tabs menu system it is very much possible to have "third level" tabs, or even to have more than 3 level tabbing system.

The key to it is retrieving the menu parents and fetching the children of the parent regardless of what level is the parent or the children. consider this menu entry :

function yourmodulename_menu() {
  $items = array();
  $items['user/%user/level1'] = array(
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );

  $items['user/%user/level1/level2'] = array(
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );
  $items['user/%user/level1/level2'] = array(
    'type' => MENU_LOCAL_TASK,
    'weight' => 0,
  );
  $items['user/%user/level1/level2/level3'] = array(
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );
  $items['user/%user/level1/level2/level3'] = array(
    'type' => MENU_LOCAL_TASK,
    'weight' => 0,
  );
  return $items;
}
Normally you cannot view beyond the level2 menu, but utilizing some coding like this will display the level3 menu entry
function yourmodulename_local_tasks() {
  $router_item = menu_get_item();
  if (!$router_item || !$router_item['access']) {
    return '';
  }
  // send the path if there is no arg 4 (we assume this is already the tab parent
  // else send the tab parent url
  $router = (arg(4)) ?  $router_item['tab_parent'] : $router_item['path'];


  // set the default for the first parent
  if (arg(2) == 'level1' && !arg(3)) {
    $router .= '/level2';
    $active = TRUE; // quick fix for the first default set active
    return FALSE;
  }

  if (arg(3) == 'level3' && !arg(4)) {
    $active = TRUE;
  }

  if (!arg(4)) {
    $active = TRUE; // quick fix for the first second level default set active
  }
  // Get all the third tabs
  $result = db_query("SELECT * FROM {menu_router} WHERE tab_parent = '%s' ORDER BY weight, title", $router);
  $map = arg();
  $current_last_path = array_pop($map);

  // build the third tabs
  $output = '';
  $tabitem = '';
  while ($item = db_fetch_array($result)) {
    $default_active = FALSE;
    _menu_translate($item, $map, TRUE);
    $linkcheck = explode('/', $item['href']);

    $item['localized_options'] = array();

    // build the query if there is any
    if (is_numeric($_REQUEST['job'])) {
      $item['localized_options']['query'] = array('job' => $_REQUEST['job']);
    }

    if ($active) {
      $item['localized_options']['attributes'] = array('class' => 'active');
      $default_active = TRUE;
      // reset the $active trap since it can only be used once
      $active = FALSE;
    }
    $current_url = array_pop($linkcheck);
    if ($current_url == $current_last_path) {
      $default_active = TRUE;
    }
    $link = theme('menu_item_link', $item);

    $tabitem .= theme('menu_local_task', $link, $default_active);
  }
  if (!empty($tabitem)) {
    $output = '
    ' . $tabitem . '

'; } return $output; }

Offcourse the code is not a copy & paste code, you may have to adjust it to your situation. but in general calling the function above will render the level3 tabs for you to use. Hope this is helpful