Knowledgebase

How to automatically notify users via email for all changes in MediaWiki

In MediaWiki there are some default options that users can themselves configure and choose whether to be notified via email for certain changes. Of course, these options have to be enabled for the whole site in the first place, so that each user can configure the option for their personal account. For example, these include notifications for changes to pages that are on the watchlist of the user, and also notifications for changes on the talk page associated with the user's personal page. With the respective pages (e.g. Recent changes page) and tools on the frontend of the site users can also track page and site changes themselves.

In this article we'll show you how to automatically notify selected users via email for all changes. You can do this by adding the option $wgUsersNotifiedOnAllChanges to the LocalSettings.php file of your MediaWiki. You need to list all the usernames of the registered users that you want to be notified. For example, with the following line added to LocalSettings.php:

$wgUsersNotifiedOnAllChanges = array( 'Admin', 'John Smith', 'Example user' );

the users with usernames Admin, John Smith and Example user will receive an email message for each of the changes on the site. They will receive emails when pages are edited, moved, protected and deleted, when new user accounts are created, when users are blocked, etc. The user will not receive an email only if that same user made the change. To disable this function either delete the line from the LocalSettings.php file or comment it out by placing the symbol # at the beginning. If you want to enable it again you only have to remove that symbol.

When you add this option for automatically sending notifications for all changes you have to consider however that on a busy site this may lead to a very big number of email messages being sent. So rather than being helpful this may cause inconvenience to the users by flooding their email addresses with messages.

The LocalSettings.php file which you have to modify to add this option is in the root MediaWiki folder on your hosting account. So, for example, if the application is installed directly in the public_html directory on your MediaWiki hosting account, then the path to the file will be public_html/LocalSettings.php. HostKnox customers can edit files with the File manager of the Pixie control panel. A different way to do it is to download the file on your local computer, edit it with a text editor (e.g. Notepad) and then upload it back overwriting the old file. Files can also be edited on the account via SSH.

For information on the different ways to track changes on the site check out the detailed tutorial on how to track changes and patrol edits in MediaWiki, or you can also read the shorter article version.

Was this answer helpful?

 Print this Article

Also Read