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 currently working at a leading web development company as a Sr. PHP Web Developer. He is the founder of the Xpert Developer. He has completed B.E. in Information Technology. Born and brought up in Ahmedabad. He loves to code and coding is all about passion for him. Follow him on twitter at Avinash Zala & Xpert Developer.

View all posts by: