Disable Wiki Account Creation

From Wikidespro
Jump to navigation Jump to search

To restrict the DesproWiki account creation, you need to edit LocalSettings.php in the root path of your MediaWiki installation.

# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;

Note: You can use the ConfirmAccount extension if you want to set up an account confirmation queue. (If not you may still proceed as follows.)
Note: New users will still be able to be created by sysops, in the following manner:

Go to Special:Userlogin, when logged in as a sysop.

   Click on "Create an account" link to get to the account creation form.
   Enter a username and an email address, and click the "by email" button.
   Note you need $wgEnableEmail=true or else the sysop must pick a password and send it to the user.
   The account will be created with a random password which is then emailed to
   the given address (as with the "forgot password" feature). The user will be requested to
   Change password at first login; when he does this, his e-mail address will also be marked as confirmed.
   When you click the "create account" button instead, you have to manually send the user his password.
   If you've set $wgMinimalPasswordLength=0 (default configuration up to
   version 1.15) and you've left the password field blank, the user will be emailed an e-mail address
   confirmation request but will be unable to access Special:Confirmemail to 
   perform the confirmation. Instead, the user will get an error (unless you've added it to $wgWhitelistRead);
   the user will be able to login with a blank password and then 
   confirm email, but their password will not have been reset (it will have to be reset manually).

It may be appropriate to edit the text displayed when a non-user attempts to log in. This can be done at MediaWiki:Nosuchuser, when logged in as a sysop.
Use plain text without any special formatting, as the formatting is ignored and the text is literally rendered. (Might have changed, see bug 12952).

You may also modify the contents of the e-mail sent to new users by editing the page MediaWiki:Createaccount-text.

To prevent even sysops from creating accounts:

# Prevent new user registrations by anyone
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['sysop']['createaccount'] = false;

To add a message on top of the login form, modify MediaWiki:Loginstart or (to place on bottom of the form) MediaWiki:Loginend.
Alternatively, use this code in your LocalSettings:

function efLoginFormMessage( &$template ) {
$template->set( 'header', "(For an account to edit articles with, contact Mrs. Nurdsbaum in room B-303, nelda.nurdsbaum@example.com )");
return true;