Disable Login/Logout in MediaWiki

  • Avinash
  • 0
  • Dec 24, 2012
  • Tips & Tricks

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

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by: