Sunday, February 7, 2016

How to hide or remove the View History tab on Mediawiki

Below are the steps to remove/disable/hide the View History tab on Mediawiki. This works as of early 2016 on Mediawiki 1.26x. Hope it helps!
  1. Login to your apps/mediawiki/htdocs directory. This is the directory which contains the LocalSettings.php file.
  2. Edit the LocalSettings.php file (open in text editor).  Add (append) the following lines
#====Begin : code to hide/remove View Source tab from Mediawiki====
function efAddSkinStyles(OutputPage &$out, Skin &$skin) {
    if(!$skin->getUser()->isLoggedIn()) {
        if ($skin->getSkinName() == 'vector') {
            $out->addInlineStyle('#ca-history { display:none; }');
        }
    } else {
        if ($skin->getSkinName() == 'vector') {
            $out->addInlineStyle('#ca-view { display:none; }');
        }
    }

    return true;
}


$wgHooks['BeforePageDisplay'][] = 'efAddSkinStyles'; 
#====End of code====

5 comments:

Deepakala said...


Thank you so much! That did the trick, you saved me more endless hours of searching for a fix.



remote yii developers

technode said...

Nice,thanks for sharing ,presented well,keep updating morebest institute for redhat linux in chennai|best institute for rhce in chennai|red hat certification in chennai|rhcsa training in chennai|red hat linux course fees|rhce certification in chennai|ccna training in chennai

Wow Thinking said...

Agree with your views, Need Help? Contact us at Microsoft Tech Support Canada or Outlook Technical Support Phone Number Canada at +1-888-582-4887 get it resolved at once. Our expert professionals will offer you a fitting solution remotely at your convenience.

BTC MONK said...

BTCMONK Provide the Best Bitcoin Trading Price in Peer to Peer Bitcoin Exchange.

viswanath said...

AWS Training in Bangalore - Live Online & Classroom
myTectra Amazon Web Services (AWS) certification training helps you to gain real time hands on experience on AWS. myTectra offers AWS training in Bangalore using classroom and AWS Online Training globally. AWS Training at myTectra delivered by the experienced professional who has atleast 4 years of relavent AWS experince and overall 8-15 years of IT experience. myTectra Offers AWS Training since 2013 and retained the positions of Top AWS Training Company in Bangalore and India.

IOT Training in Bangalore - Live Online & Classroom
IOT Training course observes iot as the platform for networking of different devices on the internet and their inter related communication. Reading data through the sensors and processing it with applications sitting in the cloud and thereafter passing the processed data to generate different kind of output is the motive of the complete curricula. Students are made to understand the type of input devices and communications among the devices in a wireless media.