I´m using an Omega subtheme in a Drupal 7 installation. I´ve set at the theme configuration, that Drupal should show the tabs ($tabs).

What I want is to show the tabs only to a specific role. I try this snippet out, wich didn´t worked. My guess is that it didn´t worked because I´ve told Drupal through the omega subtheme, to show the tabs. And the theme show them to everybody.

If I uncheck "show tabs" variable, they won´t show up, no matter what I do at my template file.

If I uncheck the tabs but add them inside my page template file, whey won´t show up either.

I want to be able to show the tabs or not according to the logged in user role. Here´s my snippet that doesn´t worked (at my page.tpl.php file):

global $user;
if (!in_array('admin', array_values($user->roles))) {
print render($tabs);
  else {}

What should I do? Thanks for your help!!


If you are using the Omega sub theme then there would be a template file for each of the regions defined by the Theme.

The content comes in the template called region--content.tpl.php

You should see the tab printed there. you can put your logic there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.