Jump to content

User talk:Subfader/Hide page tabs

Add topic
From mediawiki.org
Latest comment: 10 years ago by 65.26.252.225 in topic Thank you for this!

Per namespace

[edit]

I want to hide tabs only in a specific namespace. Is there any way to realize this? Best regards, --Tkrueger73 18:57, 24 August 2009 (UTC)Reply

Thanks, added. --Subfader 21:01, 24 August 2009 (UTC)Reply
[edit]

Could somebodey tell me what the tab-name of the "New-section"-link is...?? I tried everything ... --Dennis07; ( / ) 17:09, 24 January 2010 (UTC)Reply

I guess you mean the [+]? Then it's #ca-addsection: <li id="ca-addsection"><a href="/w/index.php?title=Manual_talk:Hide_page_tabs&action=edit&section=new" title="Start a new section [alt-shift-+]" accesskey="+">+</a></li> --Subfader 15:19, 25 January 2010 (UTC)Reply

Vector Skin

[edit]

I am using the vector skin, I want to hide the View History and View Source only for anonymous users, it says to paste code in Monobook.php / above </head>

In vector.php there is no </head> or I cant find it I am sorry, where should I paste a mod

I think it should be around "// Adds history view link" is it?

God it's complex in there, I may break something Thanks for any help

Actually </head> is missing in MonoBook.php too. Thus I am also a bit stuck. Doing a small rework of the instructions would be really cool. Cheers --[[kgh]] 12:06, 26 March 2011 (UTC)Reply
It was indeed replaced by $this->html( 'headelement' );. Above <div id="globalWrapper"> is fine too. What else is unclear in the instructions? --Subfader 21:54, 26 March 2011 (UTC)Reply
Hey Subfader, thank you! That is the kind of small rework I had in mind. :) It works perfect. I additionally inserted a typing error too, so my experiments were destined to fail. Thus I thought there is more to it. The instructions a straight forward. Cheers --[[kgh]] 23:26, 26 March 2011 (UTC)Reply
I'm confused in MediaWiki 1.19, because I can't find "globalWrapper" in Vector.php. I want to disable "View Source" and "View History" for Anonymous readers. • SbmeirowTalk12:01, 13 May 2012 (UTC)Reply

Per usergroup

[edit]

Hi, i would like to hide history tab for a group of user How can i configure my MediaWiki:common.css page? --Eva 11:17, 20 July 2011 (UTC)Reply

Implementing on Common.css rather than Monobook.php

[edit]

Hi. I've tried implementing your code to restrict certain users from seeing the History tab, but it didn't work. Is it because I use Common.css instead of Monobook.php? Are there changes to the code I should be using instead? Thanks!

You can't get PHP code (for the conditional clauses) in a CSS file working. As long as MediaWiki doesn't supply according CSS classes in the body tag, you will have to hack MediaWiki core code or edit the skin file. --Subfader (talk) 23:30, 6 May 2012 (UTC)Reply

How would I remove "read"

[edit]

Thanks and please reply on my talk page so I get notified!

li#ca-view {display:none} --Subfader (talk) 16:41, 10 June 2012 (UTC)Reply

Hide [view source] [history] [discussion] and enable to Editors in Vector skin

[edit]
  • Edit skins/Vector.php
  • find line
<!-- /debughtml -->
  • add commands
				<!-- No [view source] [[history] [discussion] ] tab for users who can not edit -->
				<?php global $wgUser; if( !$wgUser->isAllowed('edit') ) { ?>
				    <style type="text/css">
				      #ca-viewsource { display: none !important; }
				      #ca-talk { display: none !important; }
				      #ca-history { display: none !important; }
				    </style> 
				<?php } ?>

Thank you for this!

[edit]

65.26.252.225 07:49, 22 August 2014 (UTC)Reply

PHP Syntax Error

[edit]

Hi, after inserting one of your PHP examples into my Vector.php file my page fails to load. I enabled debugging in my LocalSettings.php file. It displays the following on page load:
Parse error: syntax error, unexpected '<' in /var/www/html/w/skins/Vector.php on line 157

Below is where I inserted the code sample in my Vector.php file (line #s included):

   155                 // Output HTML Page
    156
    157<!-- No [view source] tab for anonymous users -->
    158 <?php global $wgUser; if( $wgUser->isAnon() ) { ?>
    159       <style type="text/css">
    160         #ca-viewsource { display: none !important; }
    161       </style>
    162     <?php } ?>
    163
    164                 $this->html( 'headelement' );


This is the error I receive when I put your code (lines 157-162) after the $this->html ( 'headelement' ) (line 164)
Parse error: syntax error, unexpected '[', expecting T_PAAMAYIM_NEKUDOTAYIM in /var/www/html/w/skins/Vector.php on line XXX
http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php
SOLUTION= replace the -> on line 158 above with ::
Should look like this in context of the Vector.php file:

   160                 $this->html( 'headelement' )
    161
    162 <!-- No [view source] tab for anonymous users -->
    163 <?php global $wgUser; if( $wgUser::isAnon() ) { ?>
    164       <style type="text/css">
    165         #ca-viewsource { display: none !important; }
    166       </style>
    167     <?php } ?>
    168
    169 ?>
    170                 <div id="mw-page-base" class="noprint"></div>
    171                 <div id="mw-head-base" class="noprint"></div>

hi, I can't find Common.css in my mediawiki installation. any clue?