Manual:Block and unblock - MediaWiki
Jump to content
From mediawiki.org
Translate this page
Languages:
Bahasa Indonesia
Kadazandusun
Türkçe
italiano
magyar
polski
português
português do Brasil
svenska
čeština
русский
українська
اردو
हिन्दी
中文
한국어
Sufficiently privileged users (typically,
sysops
) can
block and unblock
IP addresses and user accounts from editing, uploading files,
moving
pages, and, if they have been granted such rights, protecting/unprotecting and deleting/undeleting pages.
MediaWiki handles blocks through an
abstraction layer
; extensions can add their own block types.
The mechanism for creating/updating/removing blocks and how they are logged and listed are different for each block type; the mechanism for checking whether a user is blocked, preventing blocked actions and informing the user is unified.
Standard blocking interface
MediaWiki core blocks are applied via the form at the
special page
Special:Block
There are several steps to applying a block:
Specify the IP address or user to be blocked.
Enter the IP address to be blocked, or the name of the registered user account to be blocked, in the "IP address, username or block ID:" field of the form. Note that nonexistent usernames can also be blocked, so be certain you have the correct username. You can also block a range of IP addresses; see
Help:Range blocks
for instructions.
Specify the parameters of the block.
Select the actions that the block target should be prevented from completing. A Sitewide block prevents the block target from editing all pages on the wikis, while a Partial block prevents the block target from editing the specified pages and/or pages inside the specified namespaces.
Specify a duration for the block.
You can select a predefined duration from the drop down box labelled "Expiration", or you can enter a custom value, using the
GNU standard format
, in the "Other time" field. If the duration given is "indefinite", then the block will not expire, although the IP address or user account may still be unblocked by a sysop.
Specify a reason for the block (optional).
This reason will be displayed to the blocked user if they attempt to edit a page.
Click "Add block" to apply the block.
All blocks are recorded in the
block log
, and all currently active blocks are listed at the
list of active blocks
Note that in addition to manually entering the IP address or user account to be blocked into
Special:Block
, you may also follow the "Add block" link from the toolbox in the
sidebar
when viewing the "User" or "User talk" page of the IP address or user account.
You can also click on the "block" link next following an IP address or user account name in the
recent changes list
or the
page history
Blocking options
MediaWiki version:
1.8
Several extra blocking options were added in version 1.8 of MediaWiki, which are enabled by checking a check box on the blocking form.
Block account creation
This option changes the effect of a block when blocking a user or an IP address. When enabled, the registration of new user accounts from the blocked account or IP address will be disabled while the block is in effect. However, this can be bypassed by creating an account on another wiki and visiting the wiki where the block is active, as global accounts automatically create local accounts on wikis the first time they are visited by the user. This workaround can be prevented by a global block, which can be configured to prevent account creation across all wikis.
Block emails
This option disables the blocked user's ability to use the
Special:EmailUser
interface. It is used to prevent abuse of the wiki’s email system during the block. This only affects registered users with confirmed email addresses.
Block talk page access
This option prevents the blocked user or IP address from editing their own user talk page. It is commonly used in cases of repeated abuse of the talk page or when no productive communication is expected.
Automatically block the last IP address used by this user, and any subsequent addresses they try to edit from (also called
autoblock
This option changes the effect of a block when blocking a registered user account. When enabled, the IP address most recently used by the account, and any IP addresses that the account subsequently attempts to edit from will be automatically blocked.
Apply block to logged-in users from this IP address (also called
hardblock
This option changes the effect of a block when blocking an IP address. When enabled, the block also applies to registered users editing from that IP address.
If this option is disabled, only anonymous users are affected (also called
softblock
). A softblock does not affect registered users, but does affect temporary accounts connected from the IP address and an
autoblock
caused by it.
Partial blocks
MediaWiki version:
1.33
Since MediaWiki 1.33, it is possible to prohibit the block target from making changes only to the specified pages and/or all pages in namespaces.
If a page is moved, the restriction will be switched to the new title.
Currently non-existent ("redlink") pages cannot be blocked, and setting multiple overlapping blocks with different expiration dates is not supported.
In MediaWiki 1.33 and 1.34, partial blocks are disabled by default.
It can be enabled by setting
$wgEnablePartialBlocks
true
MediaWiki version:
1.35
Since MediaWiki 1.35, partial blocks are always enabled and cannot be disabled.
You may hide partial blocks form elements by adding
some JS or CSS
to user or site common.js/common.css.
This does not disable partial blocks which may still be set via API.
MediaWiki version:
1.37
Since MediaWiki 1.37, users can be blocked from performing certain actions, while still being able to edit wiki pages.
The core actions that can be blocked are: creating pages, moving pages, uploading files.
Between MediaWiki 1.37 and 1.44, this feature was disabled by default, and could be enabled by setting
$wgEnablePartialActionBlocks
true
Multiple blocks
MediaWiki version:
1.44
Since MediaWiki 1.44 with
$wgEnableMultiBlocks
set, sysops can add multiple layered blocks to the same target – a feature known as "multiblocks".
See
Help:Manage blocks
for more information.
Unblocking
An IP address or registered user account can be unblocked via the
list of active blocks
Find the IP address or registered user account you wish to unblock in the list (you can enter the address or name in the "Find a blocked user" field to help you find the entry), and click the "unblock" link displayed to the right of the block's expiry time.
This will lead you to a confirmation page.
Enter the reason for unblocking (optional) in the "Reason:" field, and click "Remove this block" to remove the block.
All unblockings are recorded in the
block log
Note that if a range is blocked, then the unblock must cover the whole range to be effective.
Attempting to unblock an individual IP address in the range will not be effective.
Effects of being blocked
When
$wgBlockDisablesLogin
is enabled, blocked users are locked out of their account entirely.
This is mainly meant for private wikis which need a mechanism to revoke reading privileges once a user is not active anymore.
On other wikis, blocked users may still read pages, but they may not create, edit or move pages, or upload files.
Partially blocked users may not edit the particular pages or namespaces specified in their block, but may create, edit or move other pages, and may upload files.
Users with certain other
user rights
may not be able to use those rights when they are blocked, depending on their block.
For example, users with the rights to delete and undelete or protect and unprotect pages will not be able to do so if they are sitewide blocked.
If they are partially blocked, then for any page they are not blocked from, they will still be able to perform these actions.
However, users with the rights to block and unblock users will still be able to do so when they are blocked. Unblocking your own account requires the extra right
unblockself
; by default all sysops have this but on large wikis it might make sense to remove it to make potential account takeovers less disruptive.
Users who are blocked and attempt to edit a page (or move a page, or upload a file) will see the
"Your account or IP address has been blocked" message
informing them that they have been blocked.
If the
autoblock
option has been enabled with respect to a block, and the blocked user attempts to edit (or move a page, or upload a file), the IP address being used by that user will also be blocked.
Configuration settings related to blocking
The configuration options below can be set in
LocalSettings.php
and can be used to enable or disable certain aspects of the blocking interface.
$wgAutoblockExpiry
– controls how many seconds need to pass until a block on an "autoblocked" IP address will expire. The default is 86400 seconds (one day)
$wgBlockAllowsUTEdit
– controls whether or not a blocked user is able to edit their own user talk page. This is currently (1.26+) true by default. The ability to disable the ability of a blocked user to edit their own user talk page, when this variable is true, is an option available in
Special:Block
The
blockemail
user right
controls the ability for sysops to prevent users from using the
Special:EmailUser
interface.
$wgBlockDisablesLogin
– controls if blocked users will be prevented from logging in. This is false by default.
$wgCookieSetOnAutoblock
– (1.29+) determines whether to set a cookie when a user is autoblocked. Doing so means that a blocked user, even after logging out and moving to a new IP address, will still be blocked. This is enabled by default.
The
hideuser
user right controls the ability for sysops to prevent a blocked user from appearing in the block log, the active block list, and the user list.
$wgEnableMultiBlocks
– (1.44+) allows sysops to create multiple layered blocks per target with the new
manage blocks interface
Default block duration options
To change the default options listed in the
Expiration
drop-down menu, edit the page
MediaWiki:ipboptions
The options are stored as a comma-separated list of "label:value" strings, for example
6 hours:6 hours,infinite:infinite
To have three options listed in Spanish, the page could include
6 horas:6 hours,2 días:2 days,para siempre:infinite
The default duration is "other".
To specify another default duration, edit the page
MediaWiki:ipb-default-expiry
and enter the value you want.
Note that you must write the value and not the label, if you were using the Spanish example listed above,
MediaWiki:ipb-default-expiry
should be
infinite
(the value) and not
para siempre
(the label).
MediaWiki version:
1.35
To specify a default duration for anonymous users, edit the page
MediaWiki:ipb-default-expiry-ip
and enter the value you want.
Using the Spanish example listed above, you could write
2 days
(the value) but not
2 días
(the label).
MediaWiki version:
1.45
To specify a default duration for temporary accounts, edit the page
MediaWiki:ipb-default-expiry-temporary-account
and enter the value you want.
Interface messages
More blocking-related interface messages
More blocking-related interface messages
URL parameters
MediaWiki version:
1.18
Special:Block
accepts some URL parameters to prepopulate the HTML form:
wpTarget
– username/IP address
wpEditingRestriction
– the type of block restriction (=sitewide or =partial)
wpPageRestrictions
– the pages to block (only applies for partial blocks; separate multiple pages with %0A; maximum 10 pages)
wpNamespaceRestrictions
– IDs of the namespaces to block (only applies for partial blocks; separate multiple namespaces with %0A; see
API:Block
for a list of blockable namespace IDs)
wpExpiry
– expiry time
wpAutoBlock
autoblock
setting (=1 or =0)
wpHardBlock
– hard block setting (=1 or =0)
wpCreateAccount
– prevent account creation (=1 or =0)
wpReason
– reason, from selection of
MediaWiki:Ipbreason-dropdown
wpReason-other
– prepopulating "other reason" text field
MediaWiki version:
1.44
In MediaWiki 1.44 with
multiblocks
enabled, Special:Block takes these additional parameters:
id
– The ID of the block to modify
remove
– Whether the block is to be removed (=1 or =0). This requires that
id
also be set
Hooks
BlockIp
– occurs whenever the software receives a request to block an IP address or user
BlockIpComplete
– occurs after the request to block an IP or user has been processed
UnblockUser
UnblockUserComplete
– like BlockIp/BlockIpComplete, for unblocking
AbortAutoblock
– occurs when creating an autoblock, allows extensions to cancel
PerformRetroactiveAutoblock
– similar to AbortAutoblock but called when doing a retroactive autoblock (when performing a block, also autoblocking the user's last used IP)
GetUserBlock
– when the software checks for blocks, can be used to modify existing blocks or implement new types of blocks
UserIsBlockedFrom
– can be used by extensions which reimplement user talk pages in some way (e.g.
Extension:LiquidThreads
) to honor the "allow the user to edit their own talk page" flag
UserIsBlockedGlobally
– similar to GetUserBlock, but for global blocks (which are for historical reasons handled separately)
OtherBlockLogLink
OtherAutoblockLogLink
– allows cross-linking Special:BlockList and Special:AutoblockList respectively with similar special pages provided by extensions
SpecialBlockModifyFormFields
– allows modifying the core Special:Block form
SQL
Main page:
Manual:Block table
All types of blocks are stored in the
block
table.
Older versions of MediaWiki (before 1.42) used the
ipblocks
table instead, but stored user account blocks there as well.
Only currently active blocks are stored here.
To see old blocks, check the
logging
table.
ipb_address
is a string and can be a username, an IP address, or blank.
ipb_user
contains the
user_id
of the blocked user.
Here is how to filter for different kinds of blocks:
The data on who was blocked is stored in the
block_target
table, keyed by
bl_target_id
User blocks –
WHERE bt_user != 0
IP address blocks –
WHERE bt_user IS NULL AND bt_range_end = ''
IP address range blocks –
WHERE bt_range_end != ''
Who blocked them?
Auto blocks –
WHERE bl_parent_block_id IS NULL OR bl_parent_block_id = 0
Admin blocks –
WHERE bl_by_actor = 1234
(replace number with user ID of the blocking admin)
What are they blocked from?
Partial blocks –
WHERE bl_by_actor = 0
Full blocks (not a partial block) –
WHERE bl_by_actor = 1
How long are they blocked?
Blocks that are indefinite –
WHERE bl_expiry = 'infinity'
Blocks that expire –
WHERE bl_expiry != 'infinity'
See also
Help:Blocking users
Manual:Block abstraction layer
for writing blocking extensions or other code that interacts with blocks
Extensions implementing new block types:
Extension:GlobalBlocking
– for allowing multi-wiki blocking of IP addresses and ranges
Extension:TorBlock
– automatically block Tor exit nodes
Extension:RegexBlock
– allow blocking by username patterns
Code stewardship
Maintained by
Trust and Safety Product
Issue tracker:
Phabricator MediaWiki-Blocks
Report an issue
Log actions
Events
Blocking
Importing
Merging histories
Page deletion
Page moving
Page undeletion
Patrolling
Protection
Renaming a user
RevisionDelete
Thanking
Uploading
User creation
User rights management
Merging users
Settings
$wgLogTypes
$wgLogActions
$wgLogNames
$wgLogHeaders
$wgLogActionsHandlers
$wgLogRestrictions
$wgFilterLogTypes
$wgActionFilteredLogs
Miscellaneous
Logging to Special:Log
API
logging
table
Dummy revision
Retrieved from "
Category
Block
Manual
Block and unblock
Add topic
US