Extension talk:CategoryWatch

From Organic Design wiki
Revision as of 03:42, 20 April 2009 by Nad (talk | contribs) (User friendly message: current msg)

A feature that's missing from the MediaWiki Watchlist functionality is that if you watch a category page, you will only be notified when the content of the category page text changes. You won't be notified when pages are added to or removed from that category though which is probably the main information you were wanting.

It would be nice if, in addition to the normal behaviour, a message could be sent to the user listing the added and/or removed member articles.

This functionality would need to be added to the ArticleSaveComplete hook. The category links should be recorded at the start of the request if action is "submit", and then checked against that original state after the article is saved, if its changed, the notification message is sent (preferably using the same code as the normal Watchlist functionality).

Development notes

The notifyOnPageChange method in the EmailNotification class (in UserMailer.php), handles the mailing out of the notifications to all watching users, it takes $editor, $title, $timestamp, $summary and $minor parameters. The composeCommonMailtext method sets the EmailNotification object's from, replyto, subject and body properties using the enotif_body and enotif_subject messages.

So the simplest implementation would be to hook in to ArticleSaveComplete where it creates a list of affected categories with a message for each, then changes the enotif_body and enotif_subject messages, calls notifyOnPageChange, then restores the messages again. To assess the affected categories, it needs to know the content of the previous revision, or perhaps it can record the category links before and after being updated.

Error in mediaWiki-1.13.2

Fatal error: Cannot redeclare wfsetupcategorywatch() (previously declared in /var/www/extensions/CategoryWatch /CategoryWatch.php:163) in /var/www/extensions/CategoryWatch/CategoryWatch.php on line 179(http://setup.organicdesign.co.nz/wiki/index.php)

Resolved, this extension was declared twice as it is in general extensions --Sven 21:49, 22 October 2008 (NZDT)

This could be due to an old versionbeing run on OD which currently contains a bug --Sven 21:39, 22 October 2008 (NZDT)

User friendly message

Make a better message with more information in it using a lot of the same code as EmailNotification::composeCommonMailtext() in includes/UserMailer.php.

The normal watched article notification content is as follows:

Dear Nad,

the P2P Foundation page Panarchy has been changed on 19:03, 5 March 2009 by Mbauwens, see http://www.p2pfoundation.net/Panarchy for the current version.

See http://www.p2pfoundation.net?title=Panarchy&diff=0&oldid=26491 for all changes since your last visit.

Editor's summary: -

Contact the editor: mail: http://www.p2pfoundation.net/Special:Emailuser/Mbauwens wiki: http://www.p2pfoundation.net/User:Mbauwens

There will be no other notifications in case of further changes unless you visit this page. You could also reset the notification flags for all your watched pages on your watchlist.

            Your friendly P2P Foundation notification system

-- To change your watchlist settings, visit http://www.p2pfoundation.net/Special:Watchlist/edit

Feedback and further assistance: http://www.p2pfoundation.net/Help:Contents