Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Making Mediawiki SpecialPages only viewable by admin.
/*
Making Mediawiki SpecialPages only viewable by admin.
Copy and paste this to end of LocalSettings.php
*/
function disableSomeSpecialPages(&$list) {
global $wgUser;
if(!$wgUser->isAllowed('editinterface')) {
//remove some
#unset($list['Version']);
//remove exhaust list
foreach(array(
'Mostlinkedcategories',
'Export',
'Uncategorizedtemplates',
'Listredirects',
'DoubleRedirects',
'DeletedContributions',
'Mostcategories',
'Search',
'Block',
'Movepage',
'Mostrevisions',
'Unusedimages',
'Log',
'Mostlinkedtemplates',
'Deadendpages',
'JavaScriptTest',
'Userrights',
'Import',
'Ancientpages',
'Uncategorizedcategories',
'Activeusers',
'MergeHistory',
'Recentchanges',
'Randompage',
'Protectedpages',
'Wantedfiles',
'Listgrouprights',
'EditWatchlist',
'Blockme',
'FileDuplicateSearch',
'Withoutinterwiki',
'Randomredirect',
'BlockList',
'Popularpages',
'Emailuser',
'Booksources',
'Upload',
'Confirmemail',
'Watchlist',
'MIMEsearch',
'Allpages',
'Fewestrevisions',
'Unblock',
'ComparePages',
'Uncategorizedimages',
'Mostinterwikis',
'Preferences',
'Categories',
'Statistics',
'Version',
'UploadStash',
'Undelete',
'Whatlinkshere',
'Lockdb',
'Lonelypages',
'Mostimages',
'Unwatchedpages',
'Shortpages',
'Protectedtitles',
'Revisiondelete',
'Newpages',
'Unusedtemplates',
'Allmessages',
'CachedPage',
'Filepath',
'ChangePassword',
'Wantedpages',
'LinkSearch',
'Prefixindex',
'Recentchangeslinked',
'BrokenRedirects',
'Mostlinked',
'Tags',
'ChangeEmail',
'Longpages',
'Uncategorizedpages',
'Newimages',
'Blankpage',
'Disambiguations',
'Unusedcategories',
'Wantedcategories',
'PasswordReset',
'Unlockdb',
'PagesWithProp',
'Specialpages',
'Listfiles',
'Contributions',
'Listusers',
'Wantedtemplates'
)as $i){unset($list[$i]);}
}
return true;
}
$wgHooks['SpecialPage_initList'][]='disableSomeSpecialPages';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.