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 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. The listing is found here: Help:Namespace. Alternatively, 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; }

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 group.

Add the below coding to 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. This makes sense if you have disabled editing for anonymous users.

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

This hides the [view source] tab for users who are not allowed to edit pages. The user right  can be adjusted by your needs: Just add the according name from this list.

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: block!important; } 

How to hide talk pages from special:Allpages and special:Search (advanced)
Add the following lines to the file /w/languages/Language.php in the function public function getNamespaces:

This will prevent the _talk namespaces from appearing in the drop down dialog box (in Special:Allpages) and the check boxes (in Special:Search (advanced)). To hide the _Talk tab on an individual page, you will need to use the code stated above. This also does not affect the "edit" links on Navboxes. The Notes stated below, apply to this code as well. This does not have any affect on directly using the URL to access the page.

The physical pages can still be created (with proper permissions) and therefore read (with proper permissions). This just code just "hides" the pages from the casual user to give a better interface experience.