cogLists all the users that have edited a document
Developed by

Sergiu Dumitriu

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

This works with XWiki Platform >= 1.2

Simple and efficient query, but requires programming rights.

#set($targetDoc = $xwiki.getDocument("Main.WebHome"))
  ## Or any other document. Or just use $doc, the current doc.
#set($editors = $xwiki.search(
  "select distinct rni.author from XWikiRCSNodeInfo rni where rni.id.docId = $targetDoc.id"))
#foreach($editor in $editors)
* $editor
#end

The same idea, but works without programming rights. A bit slower, as it contains an implicit join with XWikiDocument.

## This works with the current document, $doc, but can be modified as above.
#set($editors = $xwiki.searchDocuments(
  ", XWikiRCSNodeInfo rni where rni.id.docId = $doc.id and rni.author = doc.fullName"))
#foreach($editor in $editors)
  ## Write a link and a proper name, not just the document name. Can also be used in snippet 1.
* $xwiki.getUserName($editor)
#end

The second snippet works in a single (non-virtual) wiki. When there are virtual wikis involved, things are a bit more difficult, as the author's document might be in another database. Still, it correctly selects all the editors with a local account.

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Tags: users
Created by Sergiu Dumitriu on 2008/03/13 22:07
     

Get Connected