In the user page (www.example.com/user), there are [View | Edit]
tabs. Is it possible to hide the View
tab and leave Edit
tab there?
3 Answers
Use Tab Tamer, which allows you to move, hide and disable tabs on various pages.
Tab Tamer is an administration utility that provides easy re-ordering, hiding, and deactivation of tabs and subtabs. You can also rename tab labels.
You could also just use hook_menu_local_tasks_alter()
in D7:
function MYMODULE_menu_local_tasks_alter(&$data){
foreach ($data['tabs'][0]['output'] as $key => $value) {
if ($value['#link']['path'] == "user/%/view"){
unset($data['tabs'][0]['output'][$key]);
}
}
}
-
Thank you for this nice answer! I added
if($data['tabs'])
before theforeach
in order to check whether there are any tabs. Otherwise, if that is not the case, one gets an error message.– JeroenJun 26, 2015 at 21:54
If you give the appropriate permission to the user, only then the view and edit tag will visible otherwise it will not be visible. (For checking you can sign out from the website and click the menu in user page. The view and edit tag will not visible)