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====

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