From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: unmaintained
Implementation User rights, Tag
Description Block editing of marked text, but still allow a sole contributor to work on the full text
Author(s) Loosely based on ProtectSection by ThomasV; modified by John Erling Blad
Latest version unknown (2008-05-28)
MediaWiki 1.11.0 (tested)
License No license specified
Download ProtectText.php, ProtectText.i18n.php
Translate the ProtectText extension if it is available at translatewiki.net
Check usage and version matrix.

ProtectText adds a tag and some wiki markup to make it possible to protect fragments of text or data from being removed or changed. The reason can be diverse, ranging from a simple statement of a person to a measurement taken by a researcher in a laboratory. The extension makes it possible to protect such fragments of text.


Protected text from the present text will be compared with the previous, and if it differs then the user must have sufficient rights to be able to save the page. This is either given by a basic user rights level when all previous versions of the page are written by one and only one user, or by an alternate and higher level if there are multiple contributors. Normally the user can write on the page without interference in their own user space. This makes it possible to write a research-oriented work, and then lock down portions of the work. If a page contains works by multiple contributors, then it will be necessary to let someone with additional and higher rights do the actual protection.

The basic level allows use of the protection markup when no other are writing on the page, and because of this the initial editing should be done in the users own space, and therefore the basic protection levels should be at least similar to the rights to move a page.

The alternate level is where the user must cooperate with other users to protect a page. This will be similar to ordinary protection and should follow the same user rights.

Fundamental operation is to protect large blocks of text, paragraphs of text and small fragments. Large blocks are protected through <protect>, paragraphs through an initial paragraph sign (§), and small text fragments through enclosing the text in a special wiki markup ({§ and §}).

Protecting large blocks

Protecting large sections of text can be done by the tag <protect>. This can span several subparts of the text, even parts in different sections and inside paragraphs.

<protect>This is a test with explicit block-level protection.
Such text can run over several lines or even paragraphs.</protect>
Protecting paragraphs

Most of the time it is better to protect small paragraphs instead for large text blocks. Very often this is small quotes from known sources.

§This is a protected paragraph.
This is not a protected sentence.
Protecting small parts

Very often it is possible to protect only small distinct parts of the text. This can be something like data from a statistical database.

Within this sentence there is a {§protected fragment§}.


It is of great importance that there is a clear policy about what and when to protect. If too much of the page is protected then it will become stale and slowly die compared to other articles. If too little is protected it will open up for vandalism that can be very difficult to rectify. Normally a date should be protected, but a description of what happen on that day should not be protected as rewrites would be clearly visible. Likewise a quote of a person can be, and probably should be, protected. An explanation of what this means, or a discourse should not be protected as this might change over time.

Alternatively, if something is labelled as original research and contains no references it should probably be protected with the author used as a reference. If it is public knowledge and can be verified through an existing reference it should probably not be protected.


The usual: Copy ProtectText.php and ProtectText.i18n.php to a subfolder ProtectText in the extensions folder, then add the following to LocalSettings.php :

require_once( "$IP/extensions/ProtectText/ProtectText.php");

Optionally the rights can be changed to limit protectsolecontributor to the group autoconfirmed.

$wgGroupPermissions['*']['protectsolecontributor']  = false;
$wgGroupPermissions['autoconfirmed']['protectsolecontributor'] = true;


Using nowiki tags is still possible around protected text - so if a template has been embedded into a page for example, it's still easy to stop it from being shown.


This present version as described in Installation does not work in MediaWiki 1.25.5

I took the freedom to modify the original version and added the new complete modified source listing in Extension talk:ProtectText#Updated version

This listing is running on my MediaWiki 1.25.5 server perfecty

Be aware that the TAG has changed to <protectABC> text to be protected </protectABC> 
Be aware that the file structure of the modified version is also different
Original info File path
ProtectText.php is now called extensions/ProtectABC/ProtectABC.php
ProtectText.i18n.php are now 2 new files in an new subdir extensions/ProtectABC/i18n/en.json