When I add the code from the readme to template,php, I get this text while the page is loading (and after the page loads, it appears above the header area):

// Removes User tab from Search (replaced by the ProfilePlus "User Profile" tab) /** * Override or insert PHPTemplate variables into the templates. */ function _phptemplate_variables($hook, $vars) { if ($hook == 'page') { bluemarine_removetab('Users', $vars); // replace "aquamarine" to switch themes return $vars; } return array(); } /** * Removes a tab */ function bluemarine_removetab($label, &$vars) { // replace themename with your theme's name $tabs = explode("\n", $vars['tabs']); $vars['tabs'] = ''; foreach($tabs as $tab) { if(strpos($tab, '>' . $label . '<') === FALSE) { $vars['tabs'] .= $tab . "\n"; } } }

This is the entirety of my template.php:

// Removes User tab from Search (replaced by the ProfilePlus "User Profile" tab)
/**
 * Override or insert PHPTemplate variables into the templates.
 */
function _phptemplate_variables($hook, $vars) {
  if ($hook == 'page') {
    bluemarine_removetab('Users', $vars);              // replace "bluemarine" to switch themes
    return $vars;
  }
  return array();
}

/**
 * Removes a tab
 */
function bluemarine_removetab($label, &$vars) {       // replace "bluemarine" with your theme's name
  $tabs = explode("\n", $vars['tabs']);
  $vars['tabs'] = '';

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

Thoughts? Is there something I'm supposed to put in my template.php before these functions are added? Thanks.

Comments

icecreamyou’s picture

Title: Code to remove User Tab doesn't work » Code to remove old User Tab doesn't work
Priority: Normal » Critical

I'm going to say this is critical. It's really confusing for users. There's not even a message (custom or not) that instructs users what the difference is.

brenda003’s picture

Category: bug » support
Status: Active » Fixed

You need to put <?php at the top of your file.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

pablo demono’s picture

I had the same problem, and I solved in my way:

/**
 * Removes a tab  -  profileplus
 */
function pixture_my_removetab(&$vars) {
  if (arg(0) == "search") {
	  $line = 1;	// set 1 to disable apropriate tab (in my confguration should be more then 0)
	
	  $tabs = explode("\n", $vars['tabs']);
	  $vars['tabs'] = '';

	  for($i=0; $tabs[$i]; $i++) {
	    if ($i != $line) {
	      $vars['tabs'] .= $tabs[$i] . "\n";
	    }
	  }
  }
}

/**
 * Override or insert PHPTemplate variables into the templates.
 */
function _phptemplate_variables($hook, $vars) 
{
  if ($hook == 'page') {
    // Hook into color.module
    if (module_exists('color')) {
      _color_page_alter($vars);
    }
    
    // profileplus
    if (module_exists('profileplus')) {
      pixture_my_removetab($vars);
    }
    
    return $vars;
  }
  return array();
}

In my configuration $line is set to '1'. You should try 1-3 or 2-4 depending on your theme.