Extension:Recent Activity Notify
From MediaWiki.org
|
Release status: Stable |
|||
|---|---|---|---|
| Implementation | User activity, Notify | ||
| Description | Sends an email to selected users, for actions from new or anonymous users. | ||
| Author(s) | Choshi | ||
| Last Version | 1.1 | ||
| MediaWiki | 1.15 | ||
| License | GPL | ||
| Download | Download | ||
|
|||
|
check usage (experimental) |
|||
Contents |
[edit] Description
Whats better, checking your RC page every 3 hours for spam or vandalism, or getting an email whenever that spam/vandalism occurs, whether its 3 hours, 3 days or 3 weeks from now? I thought the latter was better, hence this extension (modelled on this). 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. With this extension, whenever a page edit/creation/ page move occurs on the wiki, 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
So basically if anything new happens on the wiki, selected users will get an email. Of course both of these times can be changed in the extension. You'll see its not a lot of emails and its very helpful in preventing you from checking the RC page all the time. If there are two new users within 4 hours who make an edit, you'll get only one email. So this is useful if say, its 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.
There's a variable that we have available 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 wont have to get into LocalSettings.php for that.
[edit] Installation
- 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 wont 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).
- The title of the new page must be in this exact case-sensitive format: SITENAME:Users For Recent Activity Email Notification
- 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 dont 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.
- Download the files and extract them to /extensions/RecentActivityNotify
- Add the following line in the LocalSettings.php file:
-
-
require_once("$IP/extensions/RecentActivityNotify/RecentActivityNotify.php");
-
- 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.
[edit] Customization
- 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.
[edit] Versions
This code has been tested on MediaWiki 1.15. It should work in other versions too but it has not been tested.
[edit] Troubleshooting
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
[edit] Questions/Requests
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.