on_page_version_add event does not return version comments
PermalinkI set up notifications on page edits for my site. I would like to be informed about the comments, submitted for edited pages. Here's the code:
function on_page_version_add($page, $nv) { $l = new Log('content-change', true); if ($page->getCollectionPath()!=''){ $l->write($nv->getVersionAuthorUserName() . " have changed page '" . $page->getCollectionName() . "'."); $l->write(BASE_URL . DIR_REL . $page->getCollectionPath()); } else { $parent = Page::getByID($page->getCollectionParentID(), $version = 'RECENT'); $l->write($nv->getVersionAuthorUserName() . " have changed page '" . $page->getCollectionName() . "' under the '" . $parent->getCollectionName() . "' page (" . BASE_URL . DIR_REL . $parent->getCollectionPath() . " )."); } $l->write("Comment: " . $cv->getVersionComments() ); $l->close(); }
Unfortunately, instead of real version comment it returns something like default comment - "New Version 89". What am I doing wrong?
> modifying anything, which will clear the most recent version comments back to a
> default... it's a bug)
I've noticed some weirdness with version comments but never took the time to pin it down. Thanks for mentioning this. Has it been reported in the bug database?
-Steve
If there was a way to tie the notification to the Preview My Edits or Publish My Edits button clicks, that would theoretically make things work (or at least work right up until someone entered and exited edit mode without modifying anything, which will clear the most recent version comments back to a default... it's a bug).