User:Subfader/Hide page tabs

''This page describes how to hide page tabs. Not everything may make sense for your wiki. Use with care.''

Generally
The following needs to be added to your MediaWiki:Common.css or your personal user css.

No tab on all pages
This hides the [watch] tab on all pages.
 * 1) ca-watch { display: none !important; }

No tab per namespace
This hides the discussion tab for all pages on the Help namespace. Therefore you need to find out which number the desired namespace has. Easiest might be to check the source code of a page and scroll down to the body tag (it's stated in the body class). For the Help namespace it's the css class "ns-12":. .ns-12 #ca-talk { display: none !important; }

No tab per page name
This hides the [discussion] tab on certain pages. To find the page title for the css code; check the source code of your desired page and scroll down to the body tag (it's stated in the body class). For e.g. Help:Contents it's the css class "page-Help_Contents":. .page-Help_Contents #ca-talk { display: none !important; } Note that your Main Page title may be customized and not be "page-Main_Page".

By Conditional clauses
This describes how to hide certain tabs for certain user groups or page restrictions. Add the following at the end of the skin's head (e.g. Monobook.php above ).

No tabs for certain pages
This hides the [view source] tab on protected pages.

isProtected('edit') ) { ?>  #ca-viewsource { display: none !important; } 

No tabs for certain users
This hides the [view source] tab for anonymous users. Makes sense if you disabled editing for those.

isAnon ) { ?>  #ca-viewsource { display: none !important; } 

This hides the [view source] tab for users who are not allowed to edit pages.

isAllowed('edit') ) { ?>  #ca-viewsource { display: none !important; } 

In combination
This hides the [view source] tab on protected pages to users who are not allowed to delete pages.

isProtected('edit') && !$wgUser->isAllowed('delete') ) { ?>  #ca-viewsource { display: none !important; } 