Disable Login/Logout in MediaWiki

We all know disabling login feature in MediaWiki is very odd thing. But recently I had to work for such feature.

I want to make MediaWiki available to all user, there should not be login/logout feature at all.

After some finding I have got the solution for the same, what we need to do is to place few lines of code in LocalSettings.php which is as below:

disable login and logout functions

disable login and logout functions for all users function LessSpecialPages(&$list) { unset( $list['Userlogout'] ); unset( $list['Userlogin'] ); return true; } $wgHooks['SpecialPage_initList'][]='LessSpecialPages';
disable login and logout functions for all users
function LessSpecialPages(&$list) {
        unset( $list['Userlogout'] );
        unset( $list['Userlogin'] );
        return true;
}
$wgHooks['SpecialPage_initList'][]='LessSpecialPages';

Remove login and logout buttons

// remove login and logout buttons for all users function StripLogin(&$personal_urls, &$wgTitle) { unset( $personal_urls["login"] ); unset( $personal_urls["logout"] ); unset( $personal_urls['anonlogin'] ); return true; } $wgHooks['PersonalUrls'][] = 'StripLogin';
// remove login and logout buttons for all users
function StripLogin(&$personal_urls, &$wgTitle) {  
        unset( $personal_urls["login"] );
        unset( $personal_urls["logout"] );
        unset( $personal_urls['anonlogin'] );
        return true;
}
$wgHooks['PersonalUrls'][] = 'StripLogin';

Your are done!!!!!!

Share This Article