Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
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";
}
}
}
Comments
I tried the code below but it
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.