Bill White wrote:
> I have not looked too hard at the Phpwiki source code, but I am
> interested in creating a plugin. I want to be able to put a plugin
> something like this:
> <?plugin EmailNotification ?>
> on a page, and have appear there:
> o A list, perhaps a combo box, of the people who are currently
> scheduled for email notification when the page changes, and
> o A button which will add the currently signed in user to the
> list.
> From my 10 minute perusal of the code it was not clear to me how
> to get the first list, or how to accomplish the second task. If
> I had those two bits of data, I think it would be trivial to code
> up the rest. So, does anybody have a suggestion?
This seems like a good idea, not only for a page, but more likely for
part of a theme template, like the header or navbar. This would be like
Wikipedia's "Watch this page."
I don't know much about answering your question, tho. Here's what I do know:
- The code that generates the notifications is in WikiDB, in
getPageChangeEmails(), sendPageChangeNotification().
- A perusal of the code shows that there is a global setting 'notify'
that is a list of users and what pages they should be notified of. This
global setting is stored in a page called 'global_data' (see WikiDB::get()).
- I believe this setting is also stored by the UserPreferences plugin in
the pagedata for the user. UserPreferences seems to call
$user->setPreferences().
So, perhaps you can use $user->setPreferences() to set the 'notify'
preference to include a page. Try it and see. Look at the DB and see if
the pagedata for the user and 'global_data' are properly mutated.
Dan
|