Update comment revision id
| Project: | Comment CCK |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | bitman |
| Status: | needs review |
Jump to:
Comment CCK needs some work to play well with other modules that also implement hook_comment. When combined with the casetracker module, comment_cck creates new node revisions when comments are added, but does not notify other modules, such as casetracker, of the new revision number. As a result, casetracker tries to update the old revision instead of the latest revision.
I've attached a patch that updates the revision number so that other modules can use it and changes the module weight so that comment_cck_comment is always called first. This seems to work with the casetracker module, but I haven't tested with any others. There is a version of the patch for the stable 1.0 release and a version for 1.x-dev. You have to run update.php after applying the patch.
A related issue that doesn't affect compatibility with casetracker is that the node cached by node_load is not updated with the new vid. This could be fixed by a call to "node_load($comment['nid'], NULL, TRUE);" to flush the cache and reload the module, but for performance reasons it's best to do this only if necessary. For now, I don't see that it is necessary in this case.
| Attachment | Size |
|---|---|
| comment_cck_node_revision-1.0.patch | 1.38 KB |
| comment_cck_node_revision-1.x.patch | 1.54 KB |

#1
I've applied the part of the patch which introduces a reference.
#2
Is this change to how revisions are handled necessary in the latest release?
#3
Everything else is already updated, but this 5.x code is yet to be determined for 6.x
+ // Update comment revision id
+ $comment['revision_id'] = $node->vid;
I'm going to make a separate issue for picking a good weight value for this module.