from profile of people not in xyz role and if the tab is empty. How do I do this? Thanks.

Comments

fehin’s picture

I tried the code below but it didn't work. Without the if-statement, it works but removes the tab for all users. How can I check for a user role properly in this case. Thanks.

function _phptemplate_variables($hook, $vars=array()) {
  if ($hook == 'page') {
      if (!user_access('act as seller')){
     //if(in_array("authenticated user",$user->roles)){
      fourseasons_removetab('Shop', $vars);
     }
  return $vars;
   }

function fourseasons_removetab($label, &$vars) {
$tabs = explode("\n", $vars['tabs']);
$vars['tabs'] = '';

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