Extension:EditNotify

MediaWiki extensions manual
EditNotify
Release status: stable
Implementation Notify
Description Extension for page creation/editing notifications
Author(s) Abhinand and Yaron Koren
Latest version 1.1 (2024-02-21)
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
License MIT License
Download
  • $wgEditNotifyEnableFoo
  • $wgEditNotifyAlerts
Quarterly downloads 6 (Ranked 123rd)
Translate the EditNotify extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

EditNotify is an extension to MediaWiki that allows users to receive notifications while creating and editing a page. The extension makes use of the Echo extension to notify users.

Features

edit

The extension allows registered users to get notified for:

  • Creation of new pages
  • Edit to existing pages - Users are notified on any change
  • Change in specific template field - Users are notified when there is a change in template field
  • Change in specific template field to specific template value - Users are notified when there is a change in template field value

All users who are subscribed for any of the events listed above will be notified for them with a simple alert message (Echo notification) as well as an email. The possible sets of pages for which users can choose to be notified are:

  • All pages - keep track of change or creation of all pages
  • All pages in one or more namespaces
  • All pages in one or more categories

Requirements

edit
  • Install Echo - the EditNotify extension makes use of Echo notifications to notify the subscribed users of page creation/editing.

Download

edit

You can download the EditNotify code, in .zip format, here.

You can also download the code directly via Git from the MediaWiki source code repository. From a command line, you can call the following:

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/EditNotify.git

To view the code online, including version history for each file, go to phab:diffusion/EENF/browse/master/.

Installation

edit

To install this extension, create an 'EditNotify' directory (either by extracting a compressed file or downloading via Git), and place this directory within the main MediaWiki 'extensions' directory. Then, in the file LocalSettings.php, add the following line:

wfLoadExtension( 'EditNotify' );

As noted above, you will also need to have the Echo extension installed.

Usage

edit
  • The array $wgEditNotifyAlerts should be added to LocalSettings.php, and usernames can be added to the each sub-array within it, to get that set of users notified of the respective events.
  • Template field names, or template field name/value pairs, can be added if you wish to track those changes. Namespaces or categories to be tracked can also be added to the respective 'namespace' or 'category' keys in the array.
  • If a user wishes to receive notification of all pages, then the category and namespace keys can be omitted.
$wgEditNotifyAlerts = [
	[
		'action' => 'create',
		'users' => [ 'user1', 'user2' ]
	],
	[
		'action' => 'edit',
		'namespace' => 'namespace name',
		'users' => [ 'user2' ]
	],
	[
		'action' => 'edit',
		'namespace' => 'namespace name',
		'category' => 'category name',
		'users' => [ 'user1' ]
	],
	[
		'action' => 'edit',
		'namespace' => 'namespace name',
		'category' => 'category name',
		'template' => 'template name',
		'templateField' => 'field name',
		'users' => [ 'user1', 'user2' ]
	],
	[
		'action' => 'edit',
		'namespace' => 'namespace name',
		'category' => 'category name',
		'template' => 'template name',
		'templateField' => 'field name',
		'templateFieldValue' => 'field value',
		'users' => [ 'user1', 'user2' ]
	],
	...
];
 
Email notification when there is a change in template field to specific value

Examples

edit

Users can get notified of create and edit events for all pages. In the below example, Joe will get notified if any page is created or edited.

    [
		'action' => [ 'create', 'edit' ],
		'users' => [ 'Joe' ]
	],

Say, if users David and Ram have to get notified when a page is created, and the user John has to get notified when a non template page in 'User' namespace is edited and Charles has to track edit event in 'Uniwiki' category, then the array would look something like:

$wgEditNotifyAlerts = [
	[
		'action' => 'create',
		'users' => [ 'David', 'Ram' ]
	],
	[
		'action' => 'edit',
		'namespace' => 'User',
		'users' => [ 'John' ]
	],
	[
		'action' => 'edit',
		'category' => 'Uniwiki',
		'users' => [ 'Charles' ]
	],
    ....
];

George and Ann will get notified of the change in template value if the field value of 'full name' changes in template 'User info' in 'User' and 'Talk' namespaces. While Mia will be notified for change in field value of 'full name' in template 'User info' in any page.

    ....
   	[
		'action' => 'edit',
		'namespace' => [ 'User', 'Talk' ],
		'template' => 'User info',
		'templateField' => 'full name',
		'users' => [ 'George', 'Ann' ]
	],
	[
		'action' => 'edit',
		'template' => 'User info',
		'templateField' => 'full name',
		'users' => [ 'Mia' ]
	],
    ...

If a page in the 'User' namespace includes a template called 'User info' that has a field called 'full name' whose value changes to 'Albert Albertson', then Brennan will be notified of this event.

   	[
		'action' => 'edit',
		'namespace' => 'User',
		'template' => 'User info',
		'templateField' => 'full name',
		'templateFieldValue' => 'Albert Albertson',
		'users' => [ 'Brennan' ]
	],
	...

As could be expected, you can add as many arrays to $wgEditNotifyAlerts as you want, to handle additional events.

Version history

edit
  • 1.0.0 - August 22, 2016 - Initial version
  • 1.1 - February 21, 2024 - Removed support for MW < 1.36; many coding improvements and bug fixes

See also

edit