Table of Contents
notification Plugin
Compatible with DokuWiki
- 2025-05-14 "Librarian" yes
- 2024-02-06 "Kaos" unknown
- 2023-04-04 "Jack Jackrum" unknown
- 2022-07-31 "Igor" unknown
Needed for structnotification
Installation
This Plugin depends on the following other plugins:
Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
Description
This plugin works as an aggregation hub for notifications from other dokuwiki plugins. The idea is to inform dokuwiki users about the actions they have to take in a wiki. Currently the following plugins integrates with this plugin:
- approve – inform the maintainers about pages that aren't approved. Plugins provided:
approve
- bez – inform the users about problems and tasks they have to resolve. Plugins provided:
bez:problems_without_tasks
,bez:problems_coming
,bez:problems_outdated
,bez:tasks_coming
,bez:tasks_outdated
- ireadit – inform the users about the pages they have to read. Plugins provided:
ireadit
Syntax
List
The basic syntax to display all the notifications from all the plugins for the currently login user is:
---- notification list ---- ----
Notifications are displayed as an unordered list with the date. For example:
You can user regular expression to limit the notifications to some plugins only:
---- notification list ---- plugin: ^(approve|ireadit) ----
You can also display notifications for concrete user:
---- notification list ---- user: name ----
or use a special syntax for the currently login user (default):
---- notification list ---- user: $USER$ ----
Plugin also allows you to turn off the full message, using syntax:
---- notification list ---- full:0 ----
This will cause the plugin to display only links to the pages. For example:
You can also specify date format for the plugin using the date
parameter:
---- notification list ---- date: %Y-%m-%d %H:%M ----
The date parameter is parsed by PHP's strftime function.
You can join several parameters:
---- notification list ---- plugin: ^(approve|ireadit) user: name full:0 date: %Y-%m-%d %H:%M ----
Development
You can integrate the notification with your own plugins. To do so, you must handle three events:
PLUGIN_NOTIFICATION_REGISTER_SOURCE
The $event→data
contains an array of all plugins using notification. To register your own plugin, simply add it to the array:
$event->data[] = 'plugin_name';
PLUGIN_NOTIFICATION_CACHE_DEPENDENCIES
The $event→data['plugins']
contains an array of plugins that are currently processed by notification. You must check in this event if your plugin is on the list:
if (!in_array('plugin_name', $event->data['plugins'])) return;
The $event→data['dependencies']
contains a list of cache dependencies for your plugin.
PLUGIN_NOTIFICATION_GATHER
Generate notifications for the given user. Firstly, you must check if your plugin is on the list:
if (!in_array('plugin_name', $event->data['plugins'])) return;
The $event→data['user']
contains the login of the user for whom the notifications are listed. The $event→data['notifications']
contains the list of notifications for the given user. Each notification is an array with the following keys:
plugin
- the name of your pluginid
- the unique identifier for the notification. The notification with the given id is emailed only once to the user.full
- The full notifiaction message. May contain HTML.brief
- Short version. Usually, only the link to the page that requires action.timestamp
- The unix timestamp with the date of the notification.
$event->data['notifications'][] = [ 'plugin' => 'approve', 'id' => $id.':'.$rev, 'full' => $full, 'brief' => $link, 'timestamp' => (int)$rev ];