Topic on Project:Support desk

Jump to navigation Jump to search

[RESOLVED] registering and login

3
86.159.26.136 (talkcontribs)

how can I stop people from registering and loging in on my wiki and only let the admin login

88.130.96.120 (talkcontribs)

Hi!

You can stop registration by making your wiki private. See Manual:Preventing_access‎.

For disabling login you could add the following code to LocalSettings.php:

# 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 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';

However, if your users are clever enough, they still might be able to login anyway, e.g. via the API or by typing the URL of the login page. I don't see an effective way of preventing that as well; especially not, if admins should be allowed to login and you have no way to differentiate, whether a certain is an admin and so should be allowed, or if he is not and so should be forbidden - especially while they are not yet logged in. MediaWiki is not made for a situation, in which login is not allowed.

Reply to "[RESOLVED] registering and login"