[pmwiki-users] List the editors of a page

Eemeli Aro eemeli at gmail.com
Thu Oct 9 01:31:45 CDT 2008


2008/10/8 Nicolas Poulain <nico.poulain at gmail.com>:
> I'm looking for a way to list the people who have modified a page.

Try adding this to your config file:


function ContribList( $pagename, $level='read' ) {
  $page = RetrieveAuthPage( $pagename, $level, FALSE );
  $a = array();
  foreach ( $page as $k => $v ) if (!strncmp($k,'author:',7)) $a[] = $v;
  return implode(', ',array_unique($a));
}
$FmtPV['$Contributors'] = 'ContribList("$group.$name")';


And then using the markup {$Contributors} (or {*$Contributors} or
whatever else is appropriate for page variables in order to produce a
comma, delimited list of authors, with the most recent first. If you'd
prefer to have them in chronological order, replace the return line
with the following:
  return implode(', ',array_unique(array_reverse($a)));

Feel free to change the page variable name '$Contributors' to anything
you desire, especially if you can think of something more appropriate.

Note that this will expose these names to anyone who has read access
to the current page; to change this add a second parameter to the
ContribList call with the authorisation level you want.

Also note that like ?action=diff, this will read into memory the whole
of the page's history, which may be much more than just the latest
version of the text that's normally read, and hence may slow things
down if you use this extensively.

eemeli



More information about the pmwiki-users mailing list