Customize Mediawiki To Remove Management Links

Remove Login, Viewsource and History Links

Add the following code to LocalSettings.php:

$wgHooks['SkinTemplateNavigation::Universal'][] = function( $skin, &$links ) {

if (isset($links['user-menu']['login'])) {
    unset($links['user-menu']['login']);
}
if (isset($links['associated-pages']['talk'])) {
    unset($links['associated-pages']['talk']);
}
if (isset($links['namespaces']['talk'])) {
    unset($links['namespaces']['talk']);
}
if (isset($links['views']['viewsource'])) {
    unset($links['views']['viewsource']);
}
if (isset($links['views']['history'])) {
    unset($links['views']['history']);
}
return true;
};

Remove Toolbar Links

Add the following code to LocalSettings.php:

$wgHooks['SidebarBeforeOutput'][] = function( $skin, &$sidebar ) {
for ($i = 5; $i >= 1; $i--)
{
if (isset($sidebar['navigation'][$i])) {
unset($sidebar['navigation'][$i]);
}
}
//var_dump($sidebar);
if (isset($sidebar['TOOLBOX'])) {
$items = ["whatlinkshere", "recentchangeslinked", "specialpages", "permalink", "info"];
foreach ($items as $item) {
if (isset($sidebar['TOOLBOX'][$item])) {
unset($sidebar['TOOLBOX'][$item]);
}
}
}
return true;
};

Change Bottom Links and Page Pring Links

Edit the following wiki pages to change the default links:

“MediaWiki:Retrievedfrom”: Print page link

“MediaWiki:Privacy”: Privacy policy link

“MediaWiki:Disclaimers”: Disclaimers

“MediaWiki:Aboutsite”: About page link

Main Page Style Change

Add the following code to “MediaWiki:Common.css” to remove heading from Main Page

body.page-Main_Page h1.firstHeading { 
    display: none; 
}

Comments

comments