How to disable and enable user account creation in MediaWiki
By default, on an open MediaWiki site everyone can create user accounts. Unregistered users can create an account for themselves. Registered users can also create accounts for other users; when they are logged in they can access the account creation form by going to Tools menu on the left>Special pages button>Login/create account section>Create account button. There's a checkbox on the account creation form for creating an account with a temporary random password; when the registered user marks that checkbox they only have to specify a username and the email address of the person for whom they want to create an account. An email with a temporary password will be sent to that email address. After the user logs in with that password they have to set a new one.
User account creation can be disabled (and enabled) per user group by removing (or respectively adding) the createaccount user right from the user group. MediaWiki comes preconfigured with a few default user groups. By default, two user groups have the permission for creating accounts specifically enabled. One is the group to which all users belong, including visitors, and the other is the administrator/sysop group. Note that if a user belongs to two groups that both have the createaccount permission and you remove it from one of the groups, then the user will still be able to create accounts.
Permissions can be removed by adding some code to the LocalSettings.php file of your MediaWiki. So, for example, if you want to restrict account creation for all users, add the following on a new line in LocalSettings.php:
$wgGroupPermissions['*']['createaccount'] = false;
The asterisk * in the first pair of brackets is the symbol for the user group to which all users belong. Keep in mind that as we mentioned the user group of the administrators has this user right specifically enabled. So the above code will disable account creation for all users except administrators. In case you want to prevent administrators from creating accounts, then in addition to the above line add the following one too:
$wgGroupPermissions['sysop']['createaccount'] = false;
If you want to enable again account creation for a particular group either delete the line from LocalSettings.php or set it to true.
If you disable account creation for all users, but you want only a specific user group to be able to create accounts, then in addition to the line for disabling account creation for all users you also have to add the same line but set to true and with the label of the group in the first pair of brackets. For example, with the following:$wgGroupPermissions['*']['createaccount'] = false; $wgGroupPermissions['bureaucrat']['createaccount'] = true;
you'll prevent all users except bureaucrats from creating accounts.
The LocalSettings.php file is in the root MediaWiki folder on your hosting account. For instance, if the application is installed directly in the public_html directory on your MediaWiki hosting account, then the path to the file will be public_html/LocalSettings.php. One way HostKnox customers can edit files on their accounts is from the Files section of the Pixie control panel. An alternative is to download it on the local computer, edit it with a text editor (e.g. Notepad, Wordpad), then upload it back overwriting the old file. Files can also be modified on the account via SSH.
For more information on user groups and rights check out the tutorial on how to manage users, user groups and permissions in MediaWiki.
Was this answer helpful?
- How to change the font style and background color of the site notice in MediaWiki
- How to change the period for which changes are kept on the Recent changes list in MediaWiki
- How to disable and enable the email function in MediaWiki
- How to change the font family, size and color of text in MediaWiki
- How to edit the account options of all users in MediaWiki