Extension:Recent Activity Notify

This extension does not work for MediaWiki 1.18 and later. See at the end of this article to fix how to work with MediaWiki 1.18 (and maybe with later)
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Recent Activity Notify
Release status: unmaintained
Implementation User activity , Notify
Description Sends an email to selected users, for actions from new or anonymous users.
Author(s) Choshi
Latest version 1.1
MediaWiki 1.15
Database changes Yes
License GPL
Download Download

Check usage and version matrix.

With this extension installed, if anything new happens on the wiki, selected users will get an email. Whenever a page edit, page creation, or page move occurs on the wiki from new or anonymous users, selected users will get an email on the following conditions:

  • An email is sent only for a user who is anonymous or is a registered user younger than 4 hours.
  • Only one email is sent every 4 hours

Both of these times can be changed in the extension. It is not a lot of emails and it is very helpful in preventing you from checking the recent changes page all the time. If there are two new users within 4 hours who make an edit, you will get only one email. So this is useful if say, it has been 3 days since you had an edit. If you set your email to your cell phone SMS email, you can get an alert on your cell phone as an sms.

This extension is based upon Extension:New User Email Notification. This is a useful extension to have for small wikis. In small wikis, no one wants to keep checking Recent Changes all the time just to see if there was any vandalism or spam or activity from new users. This way you can catch and revert spam or vandalism in its early stages without having to check RC all the time. Most of us check our emails more frequently than a Recent Changes page or have email alerts set up on our computers.

There's a variable that right now called $wgUsersNotifiedOnAllChanges, which can be configured but it sends an email for every edit, even from known older users of a wiki, something which is not necessary. We only need the alerts from new users. This extension also allows you to change that list of users from the wiki. You won't have to get into LocalSettings.php for that.


  1. Create a page on your wiki that will have the list of users who want to be notified:
    • The title of the new page must be in this exact case-sensitive format: SITENAME:Users For Recent Activity Email Notification
      Where Site Name is value of the variable $wgSitename. An easy way to get the correct title for this page: Copy paste the following into your wiki, do a preview of the edit and create a page for that red link:
      --- [[{{SITENAME}}:Users For Recent Activity Email Notification]]
      So if your Site Name is "My Wiki", the page you create will have the title of: "My Wiki:Users For Recent Activity Email Notification". This will give you the ease of editing the notify list from the wiki in the browser and you won't have to go into LocalSettings.php
    • Model your new page on the following page: Sample Notify List (On this page you can edit the list of usernames and the comments with the hashes too. Leave everything else as it is).
  2. Your wiki database must have the ability to create a table in the database. The extension will automatically try to create a table. If you don't have the CREATE right for your database, try the SQL query at the end of this section in MyPHPAdmin or whatever way you can use to create the table.
  3. Download the files and extract them to /extensions/RecentActivityNotify
  4. Add the following line in the LocalSettings.php file:
Database query for table creation (only if your wiki database configuration doesnt have the Sql CREATE right)
CREATE TABLE IF NOT EXISTS `mw_ext_email_notify` (
    `user` varbinary(255) NOT NULL,
    `last_email_sent_time` varbinary(14) NOT NULL,
    PRIMARY KEY (`user`) );

This assumes your table prefix is 'mw_'. Adjust this if you have a different table naming prefix.


  • Inside the file "RecentActivityNotify.php", you can edit the value of the function email_duration to reflect how often an email can be sent. Default value: 4 hours
  • Inside the same file, change users_age_for_notify to set how young a user must be in order for an email to be sent. Default value: 4 hours.


This code has been tested on MediaWiki 1.15. It should work in other versions too but it has not been tested.


If there are any errors, make sure:

  • your wiki is version 1.15. I've not tested it on older wikis.
  • You have the correct table created in your database.
  • You have followed the format of the Sample Notify List
  • The selected users have valid emails in their Preferences


Sorry I haven't made any effort to translate this or add additional features or make it work for other versions of MW. I don't plan on doing any of that due to lack of time. I just wanted to do something quick for myself and wanted to share it with anyone else who could use it and wanted to give back to the MW community. I hope this is useful for someone. Its a good small useful utility to have for wikis that are small and don't have many edits frequently from new users. The code may not be clean but it works.

MW 1.18 fixEdit

I am only a new user about MW system, so I fixed by easy way: First You need Copy a DatabaseFunctions.php From old version (1.15) Into includes folder. I think there are no conflict.

Next, fix some rows in RecentActivityNotify.php File:

 include_once './includes/DatabaseFunctions.php';


 include_once 'includes/DatabaseFunctions.php';

If you see an error about "Cannot redeclare wfGetDB()" in your server logs, the line with "includes/DatabaseFunctions.php" must be commented out.

 require_once( 'UserMailer.php' );


 require_once( 'includes/UserMailer.php' );
  userMailer(new MailAddress( $emailtarget ), 


  userMailer::send(new MailAddress( $emailtarget ),
   function NotifyArticleSaved ( &$article, &$user, $text, $summary, &$minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId ) {


   function NotifyArticleSaved ( &$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect ) {
  $result = $db->doQuery($query);


  $result = $db->Query($query);

that's it! I tested in my wiki site!

Notify for change by any userEdit

This Extension only check and send notification when change by new (any) user. If you want it send email for every change by any user, fix this line:

  //return true; // UNCOMMENT for debug


  return true; // UNCOMMENT for debug

See alsoEdit