Closed (fixed)
Project:
Node Comments
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Oct 2008 at 21:58 UTC
Updated:
17 Oct 2010 at 06:28 UTC
Jump to comment: Most recent file
Comments
Comment #1
wrb123 commentedI would also greatly appreciate this feature so I can give my users a list of Most-Commented-On Nodes and Least-Commented-On Nodes. Thank you for supporting Drupal 6!
Comment #2
kenorb commentedI'm looking for this functionality as well.
This has been marked as duplicate: http://drupal.org/node/331177
Comment #3
OneTwoTait commentedI would like this feature too. In my case I want to show users a view that has nodes that are not commented on.
Comment #4
wrb123 commentedHas anyone figured this out? I'm struggling to make two views:
All nodes which have 0 nodecomments
All nodes which have 0 nodereferrers (or all nodes which have 0 nodes nodereferencing them)
I would greatly appreciate knowing how to do this with views. For the 2nd one I tried doing nodereferrer by type argument (or by field), but there's no way to specify "has no values" - you can just specify a single node id or something..:/
-Bill
Comment #5
wrb123 commentedi am willing to pay for this functionality. i dont know if it means a comment count filter in views, where i can say "show only nodes who have 0 nodecomments" - thats what im looking for and will pay maybe $50 for: so for all nodes on my site, i can have a view that lists every node that hasnt been commented on with a nodecomment. i think this works with regular comment module, so maybe someone could check that code out - i just dont know drupal development that well yet. thanks.
Comment #6
vbala commentedYou can get the functionality, if you copy the following lines from views module
modules/comment.views.inc:function comment_views_data()to nodecomment module'sviews/nodecomment.views.inc:comment_views_data()and add the following handlers to
function nodecomment_views_handlers()then copy the files
views/modules/comment/views_handler*_ncs_*to nodecomment module's views subdirectory.I attach the result.
Comment #7
wrb123 commentedI am at work right now, but I will try this out this evening. Could the maintainer of the nodecomments project please look at this and consider patching the main version (or updating it to a new release)?
Comment #8
wrb123 commentedIt works!
i extracted this zip file to my desktop, put my site in maintenance mode, deleted my site's old nodecomment folder, uploaded this nodecomment folder, ran update.php, and put my site back into live mode. now under Views2 filters there is an option for filtering by number of comments, and i confirmed that it works! I used "less than ____ # of comments" and put 1, so all with less than 1 nodecomment (0 nodecomments) Great!
Thank You!
-Bill
p.s. emailing you about payment
Comment #9
kenorb commentedTested, and it's working fine.
Comment #10
kenorb commentedComment #11
wrb123 commentedi dont think this should be closed just yet. actually i don't know if this is a separate issue (if it is, please move it), but it is related to the functionality the patch in this issue provided.
background: i have node types with the following relationships..
A --> B --> C --> D (nodereferrer field relationships -->) (doesnt seem relevant at first glance)
D--> DD (nodecomment node)
so basically, there is a relationship using nodereferrer with great grandparent (A), grandparent (B), parent (C), and child (D). (doesnt seem relevant at first glance) then, the child can have nodecomment nodes (comments on type D).
i have a view which outputs a page display, and it has the following filters:
Node: Type = Term
Node: Published Yes
------> Node: Comment count > 0
Content: Facebook = 1
certain nodes (of type D) don't seem to be appearing in the view (i also tried Comment count >=1, effectively the same thing with no luck)
THESE NODES ALL SEEM TO BE NODES WHOSE PARENTS GRANDPARENTS OR GREAT GRANDPARENTS WERE CREATED A LONG TIME AGO
i dont know if that makes any sense based on the way the drupal database tables work or whether or not they get updated, but this is a serious issue in my opinion. i had to go into the database manually and do an edit:
i had to manually change the comment count from 0 to 1, on a node which indeed had a comment.
UPDATE `mydatabasename`.`node_comment_statistics` SET `comment_count` = '1' WHERE `node_comment_statistics`.`nid` =2273 LIMIT 1 ;
nid is a node of type D which did have a nodecomment. for some reason the statistic wasn't being updated, so it may not be directly a problem with views. i have no idea. for now i am forced to update certain nodes that are added to the database, yet any with a totally new family structure A->B->C->D + nodecomment DD, work fine.
thanks, and if anyone would like me to clarify anything from this post please ask.
-b
Comment #12
zroger commentedcan you please provide this as a patch? As the new maintainer it would be much easier for me to review.
see http://drupal.org/patch/create
Comment #13
wrb123 commentedthe problem is i don't actually know how to fix the module. i was hoping someone else could come up with a patch, because it seems like with further testing the node comment statistics comment count is just generally not updating (seemingly at random, it's set to 0 instead of 1 even though a nodecomment is made). i have to go into the node comment statistics table and browse, sort by nid descending to get the most recent nodes, check and see if nodes with comments have a "0" when they should have a "1" and change to a 1 (or higher number if there is more than one comment per node).
Comment #14
wrb123 commentedi have created a patch that i think addresses the issue. here's what i found:
the node_comment_statistics table was only getting updated for comments made on published parent nodes. what was happening in my case was that if a node was created but remained unpublished (moderated, for example) and was nodecommented on before it was approved/published, the node_statistics table was not being updated (comment count still remained at 0). then, when the original parent node was approved/published, and the nodecomment was approved/published, the count still remained at 0. i dont see why we can't just remove the constraint that the original parent node have to be published (n.status = 1 is not necessary... we have other means to deal with published status that this module shouldnt be handling - is there ever a case where you would not want to record that a comment was made (or a number of comments) just because the parent node is unpublished? i cant think of a case).
so, i removed "AND n.status=%d ... , 1" from one line
and removed "AND n.status = 1" from another line
it now seems to work fine for my situation, i tested by adding a parent node (unpublished/moderated status), commenting with a nodecomment twice and watching the count increment to 1 and then 2, then deleting both comments one at a time and watching the count go from 2 back to 1 and then 0, and then i added another nodecomment to bring it back up to 1. seems fine, and makes views integration nodecomment count work without having to manually update the table whenever someone comments on their own unpublished node.
thanks!
- $count = db_result(db_query('SELECT COUNT(*) FROM {node_comments} nc INNER JOIN {node} n ON n.nid = nc.nid WHERE nc.nid = %d AND n.status = %d', $nid, 1));
+ $count = db_result(db_query('SELECT COUNT(*) FROM {node_comments} nc INNER JOIN {node} n ON n.nid = nc.nid WHERE nc.nid = %d, $nid));
- $last_reply = db_fetch_object(db_query_range('SELECT nc.cid, nc.name, n.created, n.changed, n.uid FROM {node} n LEFT JOIN {node_comments} nc on n.nid = nc.cid WHERE nc.nid = %d AND n.status = 1 ORDER BY cid DESC', $nid, 1, 0, 1));
+ $last_reply = db_fetch_object(db_query_range('SELECT nc.cid, nc.name, n.created, n.changed, n.uid FROM {node} n LEFT JOIN {node_comments} nc on n.nid = nc.cid WHERE nc.nid = %d ORDER BY cid DESC', $nid, 1, 0, 1));
Comment #15
wrb123 commentedp.s. this looks like, in my opinion, it should also be applied to the 2.x dev
Comment #16
tevih commentedsubscribe
Comment #17
my-family commentedI would appreciate this feature too... subscribing
Comment #18
Perhaps commentedHey, you're missing a single quote after %d on the first query in your patch.
Comment #19
Perhaps commentedComment #20
crea commentedSorry, 1.x branch is not supported anymore.
Comment #21
kompressaur commentedI am using version 6.x-2.0-beta6. Is the funtionality added? forgive my ignorance it is just i need to sort by comment count also. thanks.
Comment #22
zero1eye commentedI thought I had this problem, but instead, I had the view sorting the column so posts with 0 replies was shown first...
DOH!