Jump to:
| Project: | Comment CCK |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | bitman |
| Status: | needs work |
Issue Summary
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 |
Comments
#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.
#4
I think that the option to refresh cached node by calling
node_load($comment['nid'], NULL, TRUE);mentioned in #1, is necessary for such modules as Rules (for example). When you create a rule with "Comment has been published" trigger, the rule does not receive new values of CCK fields even if you issue Node load action. Being just an example, since I cannot be 100% sure Rules has nothing to do with this particular bug, I know that adding node_load call to the very end of
case 'update'andcase 'insert'sections of comment_cck_comment function helps to aviod this nasty bug, even though Rules module has weight=20 by default.Maybe adding this feature as an option (toggled off by default) will be a good idea. At least we should add this information to the readme.txt file, because of the nature of this cache issue, as it may be difficult for some administrators to figure it out.