Skip to content

Watchlist

The watchlist lets logged-in users track specific wiki pages and receive email notifications whenever those pages are edited.

Each user maintains a personal watchlist stored in user meta (_wbmw_watchlist key) as an array of wiki page IDs. The list is private - users cannot see each other’s watchlists.

When a watched page is saved, the plugin emails every watcher (except the user who made the edit) with a notification containing:

  • The page title
  • The name of the editor who made the change
  • A link to view the page
  • A link to the page’s revision history

Notifications are sent only if the Enable Watchlist Emails setting is enabled (default: yes).

To watch a page, visit any published wiki page and click Watch. The button appears in the page action bar. If you are already watching a page, the button shows Unwatch.

Watch and Unwatch actions update immediately via AJAX without a page reload.

Your watchlist is accessible from the wiki dashboard. The watchlist view shows:

  • All watched pages you are currently subscribed to, ordered by most recently modified first
  • The time since each page was last updated
  • An Unwatch button to remove a page from your list

Pages that have been deleted or unpublished are automatically excluded from the list display.

The watchlist fetches up to 50 watched pages at once.

The watchlist is accessed via the wiki dashboard with the following URL parameter:

?wbmw_action=watchlist

Notification emails are plain-text and include:

Subject: [Site Name] Wiki page "Page Title" has been updated
Hi [Watcher Name],
The wiki page "Page Title" has been updated by [Editor Name].
View the page: https://example.com/wiki/page-title/
View history: https://example.com/wiki-dashboard/?wbmw_action=history&wbmw_page_id=123
You are receiving this because you are watching this page.

The watchlist is managed by the WBMW_Watchlist class (static methods):

// Check if the current user is watching a page
WBMW_Watchlist::is_watching( $page_id );
// Get a user's full watchlist (returns array of page IDs)
WBMW_Watchlist::get_watchlist( $user_id );
// Add a page to a user's watchlist
WBMW_Watchlist::watch( $page_id, $user_id );
// Remove a page from a user's watchlist
WBMW_Watchlist::unwatch( $page_id, $user_id );
// Get all user IDs watching a specific page
WBMW_Watchlist::get_watchers( $page_id );
Meta Key Type Description
_wbmw_watchlist int[] Serialized array of watched wiki page IDs, stored per user