Tips & Tricks

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

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

[/cc]

Remove login and logout buttons

[cc lang=”php”]
// 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’;

[/cc]

Your are done!!!!!!

Shares:

Leave a Reply

Your email address will not be published. Required fields are marked *