I’m trying to find out who is the user who last changed a document.
Preferably, I would like to make collections based on this info…
All I can find is the Modification Date…
Using the script from this link, I do not seem to find the information on the last user in the metadata.
Is this correct( no modifying user info…), and if so, can it be done?
As @MikkoOhtamaa wrote, Plone doesn’t save the last modifier on object by default. But Plone does have version control enabled by default for Pages, News Items, Events and Link (by CMFEditions) and version metadata has the information of the latest modifier.
If it’s OK to read the information from the version metadata and limit the feature only for version controlled content types, I think, you’d need to
Register a new index (using
catalog.xmlin your add-on’s Generic Setup -profile; you may also want to register a metadata column to get the indexed data be returned in results):Register a custom search condition to be used in Topic-collections (using
portal_atct.xmlin your add-on’s Generic Setup -profile) and a metadata column to get the information listed on its tabular view:Write a custom indexer, which looks up the last modifier from the version metadata and indexes it:
And register the indexer in your add-on’s
configure.zcml:Be aware, though, that because the version control mechanism is triggered by the same events as catalog indexer, we may not be sure that the metadata for the most recent version exists when we are called to index it. Above, I apply dummy heuristics that when the repository says that the version history metadata is outdated when compared to the object to be indexed, I index the username of the current user instead (and expect that user been just editing the document).