A frequent question in the issues queues for both 6.x and 7.x branches is 'How to show tab X only under condition Y?'
Examples:
- hide tabs for specific user roles, but not for admin
- hide tabs only if PHP code returns TRUE
- hide tabs depending on Context or Rules
etc.
The difficulty of doing this, is that tabs are part of the core menu system. You need to re-write each tab's access callback
and add in the contingencies for roles, context, rules, PHP etc.
The way to do it for a single tab looks like this:
function hook_menu_alter(&$items) {
$items['my/tab/path']['access callback'] = 'my_new_tab_path_callback';
}
function my_new_tab_path_callback() {
// copy the original access callback (if any)
// change the code to your needs, e.g. add logic for context, roles, your custom PHP
// return TRUE or FALSE
}
In this issues we can bundle all ideas and figure out how to do it (if possible at all).
Closed: outdated
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.