3

I have installed the module subusers and appears a tab named "Subusers" in the profile. How can I remove this tab?

I tested this code in template.tpl.php and I didn't work:

function mytheme_preprocess_page(&$vars) {

$unwanted_tabs = array('user/%/subuser');
  foreach ($variables['tabs'] as $group_key => $tab_group) {
    if (is_array($tab_group)) {
      foreach ($tab_group as $key => $tab) {
        if (isset($tab['#link']['path']) && in_array($tab['#link']['path'], $unwanted_tabs)){
          unset($variables['tabs'][$group_key][$key]);
        }
      }
    }
  }
}

I tried with this code:

function mymodule_menu_alter(&$items) {
    unset($items['user/%/subuser']);
}

Thanks.

2 Answers 2

4

The tabtamer module provides an easy way to remove tabs, both those generated by core as well as those generated by modules.

0
0

Same issue I faced but I used patch for it which is still needs review but its work form me patch because Tabtamer hides tab from every user. So I downloaded the patch file in sites/all/modules/contrib/subuser

wget https://www.drupal.org/files/issues/subuser-remove-tab-if-no-permissions-148590-11.patch

and then applied patch with following command.

git apply -v subuser-remove-tab-if-no-permissions-148590-11.patch

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.