|
Cookbook /
CustomRecentChangesSummary: How to create RecentChanges pages for selected groups
Version: 2006-08-20
Prerequisites: pmwiki 2.1
Status:
Maintainer:
Discussion: CustomRecentChanges-Talk
Categories: Searching
Questions answered by this recipe
1.Changing RecentChanges formatOverwrite 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 changesInsert the following in your local/config.php if (@$_POST['diffclass'] == 'minor') {
unset($RecentChangesFmt['$SiteGroup.AllRecentChanges']);
unset($RecentChangesFmt['$Group.RecentChanges']);}
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 3. RecentChanges pages for selected groupsThe 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 !! GroupA (:include GroupA.RecentChanges lines=20:) !! GroupB (:include GroupB.RecentChanges lines=20:) !! GroupC (:include GroupC.RecentChanges lines=20:)
2. Use (: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 list1. The easiest way is to unset unset( 2. It is also possible to centralize omissions in 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']); NotesRelease Notes
See Also
ContributorsCommentsSee 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. |