Skip to main content
07 Aug 2012
Drupal - Remove unwanted tabs from pages
 
Both Drupal core as well as various modules add tabs to pages that are not needed for general users, or not needed at all. You may wish to link to the page in a different way, as some users don't understand that they can click on the tab above a node.
 
Method for Drupal 6
 
Solution provided by Drupal Team
 
As mentioned in the introduction, generally you should consider using Drupal 6's hook_menu_alter to remove tabs instead. However if you need to use this page's tab removal method, the below code is adapted for use in Drupal 6. The notes and info in the above steps still apply in the same way.
 
First either add the first code snippet as shown, or else merge it with your current preprocess_page() function in template.php (you cannot have two of the same function, so look for preprocess_page). In both code snippets, change all instances of "yourthemename" to the name of your current theme, and do not include the opening and closing PHP tags.
 
<?php
function yourthemename_preprocess_page(&) {
// Remove undesired local task tabs.
// This first example removes the Users tab from the Search page.

yourthemename_removetab('Users', );
}

?>
Then add this function "outside" of the yourthemename_preprocess_page() function:
 
<?php
// Remove undesired local task tabs.
// Related to yourthemename_removetab() in yourthemename_preprocess_page().

function yourthemename_removetab(, &) {
= explode("\n", ['tabs']);
['tabs'] = '';

foreach (

as ) {
if (
strpos(, '>' . . '<') === FALSE) {
['tabs'] .= . "\n";
}
}
}

?>
After saving template.php, you may need to rebuild the theme registry before your changes will take effect. This can be done by clearing the cache at Administer > Site configuration > Performance.
 
Solution used by Me
 
Here what I have used to remove unnecessary tabs in drupal6.
 
<?php
function phptemplate_preprocess(&, ) {
  if(
== 'page') {
   
yourthemename_removetab('File browser', );
  }
  return
;
}

function

yourthemename_removetab(, &) {
 
= explode("\n", ['tabs']);
 
['tabs'] = '';

  foreach(

as ) {
   if(
strpos(, '>' . . '<') === FALSE) {
    
['tabs'] .= . "\n";
   }
  }
}

?>
You will find more information of this solution on Drupal.org.

By
Vijay Thummar
Consultant at CIGNEX, India Office