Summary: How to create RecentChanges pages for selected groups
Version: 2006-08-20
Prerequisites: pmwiki 2.1
Categories: Searching

Questions answered by this recipe

  1. How can I change which information is displayed on RecentChanges pages?
  2. How can I keep minor changes from showing up on RecentChanges pages?
  3. How can I create RecentChanges pages for selected groups?
  4. How can I omit changes in certain groups from appearing on AllRecentChanges?

1.Changing RecentChanges format

Overwrite $SiteGroup.AllRecentChanges and/or $Group.RecentChanges; in your local/config.php.

The default defined in pmwiki.php is

$RecentChangesFmt = array(
  '$SiteGroup.AllRecentChanges' =>
    '* [[{$Group}.{$Name}]]  . . . $CurrentTime $[by] $AuthorLink: [=$ChangeSummary=]',
  '$Group.RecentChanges' =>
    '* [[{$Group}/{$Name}]]  . . . $CurrentTime $[by] $AuthorLink: [=$ChangeSummary=]');

The following example placed in local/config.php will display the title of a page and the change summary only, and uses a minus instead of three periods as spacer:

$RecentChangesFmt = array(
  '$SiteGroup.AllRecentChanges' =>
    '* [[$Group.$Name|$Group.$Titlespaced]]  - [=$ChangeSummary=]',
  '$Group.RecentChanges' =>
    '* [[$Group.$Name|$Titlespaced]]  - [=$ChangeSummary=]');

The PageVariables list is useful to find possible things to include.

If you want to change the format of the date, see Cookbook-V1.ChangeTimeFormat, and put that bit of code before the one described here.

2. Getting rid of minor changes

Insert the following in your local/config.php

if (@$_POST['diffclass'] == 'minor') {

Minor changes made after that will not be included in Site.AllRecentChanges or the per-group RecentChanges.

If you change the RecentChanges information as per point 1, the code for ignoring minor changes must be placed somewhere after that.

You can have "This is a minor edit" checked by default by editing Site.EditForm, changing (:input e_minorcheckbox :) to (:input e_minorcheckbox checked=1:)

3. RecentChanges pages for selected groups

The Site.AllRecentChanges page will display all changes in all groups.

If you want to create custom RecentChanges pages for selected groups, you can do any of the following:

1. Use (:include:) to display the recent changes for the selected groups:

!! GroupA
(:include GroupA.RecentChanges lines=20:)

!! GroupB
(:include GroupB.RecentChanges lines=20:)

!! GroupC
(:include GroupC.RecentChanges lines=20:)

2. Use (:pagelist:) to dynamically create a list of the recently changed pages in the selected groups:

(:pagelist group=GroupA,GroupB,GroupC order=-time:)

3. In the per-group configuration files (i.e., local/GroupA.php, local/GroupB.php, local/GroupC.php), create a special RecentChanges page to hold changes for just those groups.

$RecentChangesFmt['Site.ABCChanges'] =
     '* [[{$FullName}]]  . . . $CurrentTime $[by] $AuthorLink: [=$ChangeSummary=]';

Any per-group configuration file containing the above line will have its pages added to Site.ABCChanges (as well as the per-group RecentChanges and Site.AllRecentChanges).

Note especially the *two spaces* before the first dot -- this is important for PmWiki to be able to correctly put new entries at the top of the list after each change.

4. Omit certain groups from the AllRecentChanges list

1. The easiest way is to unset $Site.RecentChanges in the per-group configuration file (e.g. local/Test.php for the Test group) of the group to omit:


2. It is also possible to centralize omissions in local/config.php.

First, you need to make sure the page name is resolved and optionally you can set variables to hold the group and/or page name(s).

$pagename = ResolvePageName($pagename);
$group = PageVar($pagename, '$Group');
$name = PageVar($pagename, '$Name');

Now you can do customization for a group...

if ($group == 'SpecialGroup')
  unset ($RecentChangesFmt['$SiteGroup.AllRecentChanges']);

or for a page name (that is, a page with a certain name that may exist in any group)...

if ($name == 'Test')
  unset ($RecentChangesFmt['$SiteGroup.AllRecentChanges']);

or for a specific Group.Page .

if ($pagename == 'Main.WikiSandbox')
  unset ($RecentChangesFmt['$SiteGroup.AllRecentChanges']);


Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also


  • Pm on pmwiki-user list
  • Anke Wehner
  • Hagan Fox on pmwiki-users


See discussion at CustomRecentChanges-Talk

User notes : 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.