How to prevent users from creating pages in MediaWiki

On an open MediaWiki site all users, including unregistered ones, can create new pages. If you want to, you can prevent users from creating pages. This is done per user group. This means that it's achieved by removing the user right to create pages from the user group and consequently the users belonging to the group will not be allowed to create pages. Note that a user can belong to more than one group and if one of these groups is allowed to create pages, then the user will be able to do it.

You should also keep in mind that disabling the user right for editing pages also means that the users from that user group will not be able to create pages. For information on how to do that check out the article on how to restrict users from editing pages in MediaWiki.

To disable the creation of pages for a user group you have to add a line of code at the end of the LocalSettings.php file of your MediaWiki. For example:

$wgGroupPermissions['*']['createpage'] = false;

will prevent unregistered/anonymous users from creating pages. The symbol * stands for the most basic user group to which all users belong, including anonymous visitors. However, the group of the registered users has the permission for creating pages specifically enabled, so registered users will not be affected; they will still be able to create pages. If you don't want the preconfigured group for the registered users to be able to create pages, in addition to the above line you also have to add the line:

$wgGroupPermissions['user']['createpage'] = false;

The user group is the group of the registered users to which all registered users belong. Note that the other preconfigured groups that come with MediaWiki don't have the createpage permission specifically enabled, so if you disable it for the general group of the registered users, this will also affect the group of the administrators/sysops and the one of the bureaucrats. So in this case if you want one of these groups to be able to create pages, you have to specifically add the permission to that group. For example, if you don't want registered users to be able to create pages, but you want to allow administrators to do it, in addition to the above lines you also have to put:

$wgGroupPermissions['sysop']['createpage'] = true;

Another thing to note is that there are separate permissions for creating pages and for creating discussion pages (or also known as talk pages). So if you disable the createpage permission for a user group, the users from that group will still be able to create discussion pages. The creation of talk pages is managed with the createtalk permission.

As you know each page can have an associated talk page on which users can discuss that page. If you don't want users to be able to create talk pages, you can prevent them from doing it using the same code as shown above. You only have to replace the user right in the second pair of brackets. For example, putting the following on a new line at the end of LocalSettings.php:

$wgGroupPermissions['*']['createtalk'] = false;

will prevent unregistered users from creating talk pages. The user right for creating talk pages is added to the same default user groups as the one for creating pages. It's added to the most general group to which all users belong (labeled with * in the code) and the group of the registered users (labeled with user). So everything described above for the permission for creating pages also applies to the one for creating talk pages.

The LocalSettings.php file that you have to modify to change user permissions is in the root MediaWiki folder on your MediaWiki hosting account. So, for example, if the application is located directly in the public_html directory on the account, making the frontend URL, then the path to the file on the account will be public_html/LocalSettings.php. HostKnox customers can view and edit files on their accounts using the File manager of the Pixie control panel. Another way is to download the file on your local computer, edit it with a text editor (e.g. Notepad) and upload it back.

If you need information on how to create pages, check the section on creating pages in the tutorial on how to manage pages in MediaWiki, or you can also read the respective shorter article version.

For more information on users and user rights check out the tutorial on how to manage users, user groups and permissions in MediaWiki and in particular the section on changing permissions.

When it comes to preventing users from viewing and managing content you may also find useful the articles:

Was this answer helpful?

 Print this Article

Also Read