Recent Changes - Search:




Summary: Add or remove a page from your watchlist trail with a single click.
Version: 20110325
Prerequisites: PmWiki 2.2.17 or newer
Status: beta
Maintainer: Petko
Users: +1 (view / edit)
License: GPL3+


The recipe offers an easier way for authors to manage their watchlist trails.

WatchLists are used by wiki authors to monitor changes to a selected list of pages. The watchlist can be displayed in a profile page or can serve to send e-mail notifications to the author.

Watchlists are organized with WikiTrails, simple bulleted lists of links to the watched pages. This recipe enables easy addition or removal of a page to the watchlist trail of the author.


The recipe requires PmWiki version 2.2.17 or newer.

  • Copy addtowatchlist.phpΔ to your cookbook directory.
  • Add to local/config.php such a line:
    $PostConfig["$FarmD/cookbook/addtowatchlist.php"] = 100;
You can insert a "Watch"/"Unwatch" link into your page actions (View, Edit, History, Print...). Edit your wiki page Site.PageActions and add a line like this:
* %rel=nofollow% [[{*$FullName}?action={*$WatchlistAction} | {*$WatchlistText}]] %%


You can configure the watchlist page format, related to the Author profile page. In config.php you could add one of those lines:

$WatchlistTrailFmt = '{$FullName}-Watchlist'; # for Profiles.UserName-Watchlist
$WatchlistTrailFmt = 'Watchlists.{$Name}';    # for Watchlists.UserName

The page variables in the format are related to the user profile page. This format is not required, if not set, the user profile page will be used.


If you add the special link in Site.PageActions, this link will appear on every page. If the page isn't in your watchlist trail, you will see the "Watch" link; if it is, you will see the "Unwatch" link. Clicking on this link will open your watchlist trail, with an added or removed link to the page.

Your watchlist trail will look like this:

It lists the pages you are watching (newly added pages appear on top); clicking on the "Unwatch" link will remove the page from the trail.

The recipe adds 3 new PageVariables and a conditional which can be used in wiki pages and in pagelists:

  • {*$WatchlistStatus} : "1" if the current page is watched, "0" otherwise.
  • {*$WatchlistAction} : should be used in the special link and is "unwatch" if the page is watched, "watch" otherwise.
  • {*$WatchlistText} : the link text, "Watch" or "Unwatch", but shows the translated text in international wikis.
  • {$WatchlistTrail} : the watchlist trail page of the current user.
  • (:if watching Group.Page:) the conditional; Group.Page is not required, if missing, the current page is assumed.


For international wikis, you can translate the following strings, eg. in your French XLPage:

 'Watch'   => 'Suivre',
 'Unwatch' => 'Ne plus suivre',


  • An author name is required for the script to know where is your watchlist trail page, and you need edit permissions for that page. If you aren't logged in and follow a "Watch" link, you may see two prompts, one for your name, the other for the password (depending on your wiki configuration).

Change log / Release notes

  • 20110325 : fixed typo in 2 variable names, reported by RandyB.
  • 20110322abc : default the recipe actions to lowercase "action=(un)watch"; added $WatchlistTrailFmt; removed global $AuthorListPage, minor refactoring of the code; added {$WatchlistTrail}.
  • 20110321a : fixed problem with lost history, reported by RandyB.
  • 20110321 : first release, ready to be tested.

See also

  • WatchLists explains how to configure the pagelist for a more convenient monitoring of the changes.
  • TrackChanges Ways to more easily detect and verify all recent edits
  • Notify How to receive email messages whenever pages are changed on the whole wiki site, individual groups or selected watchlists of pages
  • WikiTrails Trails from lists items from a single page


  • Recipe written and maintained by Petko (5ko [snail] 5ko [period] fr).
  • If this recipe helps you or saves you time, you can help support its continued development by .


See discussion at AddToWatchlist-Talk

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on August 05, 2015, at 12:28 PM