2

I created a new table in the database to associate comments to the node version they were submitted against. Now when the node renders, I only want to display comments that are associated with the specific node vid. I thought about querying the db in hook_node_view to remove the comments that don't apply, but ideally only comments associated with the vid are added to the node in the first place. Is there a better way to implement this? Can I get at the node right before the comments are added to it?

0

Apparently, the comment metadata populated after node_load comes from comment_node_load(). But indeed the comments themselves aren't added until view time at comment_node_view(), which calls comment_node_page_additions() which adds the renderable comments, which calls comment_get_thread() to load the cids.

So perhaps it would take adding vid column to the comment table, and then adding vid condition in comment_get_thread...hmmm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.