Adding / Removing account access features in MediaWiki

MediaWiki by default allows any user to edit, create, and manage the Wiki site. Depending on what the Wiki is designed for, the administrator may want to restrict certain functions from the users. This Article will explain how to remove the create account link, restrict viewing and editing accounts, and page creation.

Note! Changing the values to False will disable the access and True will enable the access.

Account Access

How to remove the create account link?

The default account creation link at the top of the MediaWiki site can be disabled by editing the code in the LocalSettings.php file. This section will explain how to disable the Create account link at the top of the MediaWiki site.

  1. Log into cPanel
  2. Navigate to the Files > File Manager. Select click Go. Navigate to the MediaWiki location. An example of the location would be:

    /home/userna5/public_html/mediawiki

  3. disable-create-account-mediawiki-1

    Select the LocalSettings.php file and click code editor.

  4. disable-create-account-mediawiki-2

    Add the following code to the file.

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

    Click save


    disable-create-account-mediawiki-3

    Now the Create account link will be completely removed from the page.

How do I restrict viewing, editing, and creating accounts?

MediaWiki by default has the wiki fully accessible to any user that is registered to the site. In the case that the Wiki needs to be made private, and restricted to System Operators (Sysop) only . Code can be added to the LocalSettings.php to disable these features. This will restrict the viewing, editing, and account creation portions of the MediaWiki site. The following will explain how disable the edit, viewing, and account creation sections in MediaWiki.

  1. Log into cPanel
  2. Navigate to the Files > File Manager. Select Go. Navigate to the MediaWiki location. An example of the location would be:

    /home/userna5/public_html/mediawiki

  3. Select the LocalSettings.php file and click code editor.
  4. Add the following code to the file. Allows access to .css, .js functions of the user login.

    $wgWhitelistRead = array ("Special:Userlogin", "MediaWiki:Common.css",  "MediaWiki:Common.js", "MediaWiki:Monobook.css", "MediaWiki:Monobook.js", "-");

    Disables the edit feature for anonymous users

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

    Disables the account creation button.

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

    Click Save. The anonymous user will no longer be able to view edit or create any thin on the wiki..


Restricting users editing capabilities

When setting up MediaWiki for the first time, all uses, whether anonymous or registered, can edit pages in the Wiki. The following section will explain how to restrict users from the editing capability.

  1. Log into cPanel
  2. Navigate to the Files > File Manager. Select Go. Navigate to the MediaWiki location. An example of the location would be:

    /home/userna5/public_html/mediawiki

  3. Select the LocalSettings.php file and click code editor.
  4. Add the following code to the file. Restricts Anonymous editing

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

    Restricts User editing

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

    Allows sysop (Systems Operator)

    $wgGroupPermissions['sysop']['edit'] = True;

    Click Save. Now only Sysops will be able to edit the site..


Preventing users from creating pages

Users can create and edit pages by default. you may want to restrict users from creating pages that do not apply to the wiki and at the same time give them editing access. The following steps will explain how to restrict page creation in MediaWiki.

  1. Log into cPanel
  2. Navigate to the Files > File Manager. Select Go. Navigate to the MediaWiki location. An example of the location would be:

    /home/userna5/public_html/mediawiki

  3. Select the LocalSettings.php file and click code editor.
  4. Add the following code to the file.

    Restricts Anonymous users from creating pages

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

    Restricts Users from creating pages

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

    Click Save. Anonymous and Users cannot create pages now.


Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X