Knowledgebase

How to enable and disable options related to blocking users in MediaWiki

In MediaWiki there's a feature for blocking users. On the form for blocking users there are some options that are displayed as checkboxes with which you can allow or not the blocked user to do various things. By enabling and disabling corresponding options in the LocalSettings.php file of your MediaWiki you can remove some of the options from the frontend form for blocking users or make others available. In this article we'll go over the options related to blocking users that you can enable and disable in LocalSettings.php, and we'll explain which options on the frontend form they affect.

Some of them are enabled by default, while others are disabled. Note that they are set in the DefaultSettings.php file, but if you want to change the configuration you shouldn't modify that file; you should add the options to the LocalSettings.php file instead. Each of these options can be set in the file to either true or false which means respectively that it's enabled or disabled. An exception is one of the options that has a numerical value.

For a detailed review of the options on the frontend form for blocking users check out the section on how to block users in the tutorial on managing users, groups and permissions in MediaWiki.

Now let's go over the options:

  • $wgAutoblockExpiry

This option sets the time after which autoblocked IPs are unblocked. Its value is configured in seconds. By default it's set to 86400 (seconds) which equals 24 hours. With this option you can change the time that has to pass for autoblocked IPs to be unblocked. On the frontend form for blocking users there's a setting Automatically block the last IP address used by this user, and any subsequent IP addresses they try to edit from. When it's enabled the IP addresses from which a blocked user logs into their account are automatically blocked for the time set by the option $wgAutoblockExpiry. So, for example, if you add the following line to LocaSettings.php:

$wgAutoblockExpiry = 172800;

then the time after which automatically blocked IPs are unblocked will be set to 172800 seconds (or 48 hours).

  • $wgBlockAllowsUTEdit

This is set to false by default which means that blocked users cannot edit the talk page of their personal user page on the site. If you set it to true, the checkbox Prevent this user from editing their own talk page while blocked becomes available on the block form on the frontend of the site. If you leave the checkbox unmarked when you block a user, then the user will be able to edit the discussion page of their personal page. If you mark that checkbox when you block a user, that user won't be able to edit the discussion page associated with their personal page on the site. If you want to enable this option just put the following on a new line in LocalSettings.php:

$wgBlockAllowsUTEdit = true;

To disable it again either delete that line or set it to false.

  • $wgSysopEmailBans

This is enabled by default. It displays on the form for blocking users on the frontend the checkbox Prevent user from sending email. If you leave that checkbox unmarked, then the blocked user will be able to use the form on the site for sending emails. If you mark the checkbox, then the user will not be able to send emails using the email function on the site. Note that the checkbox is visible and can be configured only by those users who belong to user groups that have the user right blockemail. By default, only the administrator/sysop group has that right. If you want to remove the checkbox Prevent user from sending email from the form for blocking users, put the following on a new line in LocalSettings.php:

$wgSysopEmailBans = false;

Note that when it's set to false blocked users will be allowed to use the email function.

  • $wgBlockDisablesLogin

This is disabled by default. This means that every blocked registered user will still be able to log into their account (without the permission to edit content or perform actions with pages). If you enable it, no option will be added to the frontend form for blocking users, but all blocked registered users automatically will not be allowed to log into their accounts. If you want to enable it put the following on a new line in the LocalSettings.php file:

$wgBlockDisablesLogin = true;

As usual, to disable it again either set it to false or remove the line from LocalSettings.php.

  • hideuser permission

This is an available user right that can be given to user groups. By default, no user group has that permission. If you add that permission to a user group, then the checkbox Hide username from the block log, active block list and user list will be added to the form for blocking users. Of course, that group should also have the user right to block users. If you mark this checkbox, then the blocked user will not be displayed on the user list, the list with the blocked users and the block log. The blocked user will be only visible to those users that belong to a group that has the hideuser permission. Since by default the only user group that has the right to block users is the sysop (administrator) group, we'll give an example of how to add the right to that user group. Insert the following on a new line in LocalSettings.php:

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

In case you want to give the right to another group just put the name of that group in the first pair of brackets.

The LocalSettings.php file is in the root MediaWiki folder on your MediaWiki hosting account. If, for instance, the application is installed directly in the public_html directory on the account, the path to the file will be public_html/LocalSettings.php. HostKnox customers can edit files from the Files section of the Pixie control panel. An alternative is to download the file on your local computer, edit it with a text editor (e.g. Notepad) and upload it back overwriting the old file. Files can also be edited via SSH.

Was this answer helpful?

 Print this Article

Also Read