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

1 comment:

Deepakala said...


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



remote yii developers