Revision [23605]

This is an old revision of WikiPageWatch made by IanHayhurst on 2018-07-13 07:37:34.

 

WikiPageWatch

By Chumang Sango 2009 for V1.1.6.2
Ported IanHayhurst 2018 for V1.3.7 pluginsystem

Yet another email notification plugin allows users to watch / unwatch a page by opting in or out of email notification for page changes or comments. Uses an additional table to track pages and watchers. I'm including it here as I modified the original work by Chumang Sango to use the plugin system.

Files Added / Modified

WikiRoot/
|-- libs
|   \-- Wakka.class.php
|-- plugins
|-- actions
   | |-- watchlink
|   \-- watchlink.php
|-- config
| \-- options_menu.inc
| |-- options_menu.user.inc
| |-- options_menu.admin.inc
|-- handlers
   \-- addcomment
       | \--addcomment.php
   |--edit
      | \-- edit.php
   |--pagewatch
   | \--pagewatch.php
   |-- unpagewatch
   \-- unpagewatch.php

A new table was added to the underlying database. The table name is wikka_page_watch and it will serve as the watch list. The structure of the table is shown below:
Field Type Null
page_tag VARCHAR(75) No
user_name VARCHAR(75) No

The PRIMARY key for the table is a combination of page_tag and user_name. Examples of page_tag values include WelcomePage, RecentChanges, etc. Examples of user_name values include JohnSmith, JohnDoe, etc. When a user subscribes to a page, his name and the tag of the page will be added to this table. The opposite happens when a user decides to unsubscribe.

Two new functions are added to the Wakka.Class.php file. These functions are :
WatchWiki ( ): This function constructs a module that will be displayed on a wiki page. This module has a link in it which will allow a user to watch the page (if the user does not already exist in the watch list of the page), or to stop watching a page (if the user is already watching the page). altered just to return bool if page is watched or not

NotifyWatchers ($tag, $type=''): This function will send out an email message to all users that are on the watch list of a page when a change is made on the page. The $tag parameter is used to specify the tag of the page whose watchers need to be notified. The $type parameter is used to specify the type of notification. There are currently two types of notification – ‘comment’ (used when a new comment is made on a page) and ‘edit’ (used when page content is changed). The $type parameter is option, and a generic change message will be generated if it is not specified.

The addcomment.php and edit.php handlers are modified to include a call to the Notify Watchers function of the main class. This is necessary to ensure that watchers are notified of changes the moment they are made.

destructions sectiondraft

Enable wiki for use of plugins detailed here: InstallingPlugins

Add menu action {{watchlink}} config/option_menu.inc
Create new table (mention table prefix)
CREATE TABLE 'wikka_page_watch' (
 'page_tag'  varchar(75) NOT NULL,
 'user_name'  varchar(75) NOT NULL,
 PRIMARY KEY  ('page_tag','user_name') )
 ENGINE=MyISAM DEFAULT CHARSET utf8 COLLATE  utf8_unicode_ci;




Troubleshooting:
SELinux Http can't send mail
var/log/maillog shows:
postfix/sendmail[29013]: fatal: open /etc/postfix/main.cf: Permission denied
Fix with:
setsebool -P httpd_can_sendmail=1




CategoryUserContributions
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki