Comment Count Update

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-22-2007, 07:11 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 537
I think there is a bug with the way the link_comments field is updated in the links table. I have several stories where the comment count has been reset when a comment has been added (example - 2 comments already there, 3rd added, count now at 1).

This is will pligg b9.5, shared host running on linux.

The update seems to happen in libs/comment.php, at the line $link->adjust_comment(1). For now (after a couple of attempts) I've let it re-calculate the comment count everytime a new comment is posted:

Code:
$comment_count = $db->get_var("SELECT count(*) FROM " . table_comments . " WHERE comment_link_id='$comment_link'");
$sql = "UPDATE " . table_links . " SET link_comments='$comment_count' WHERE link_id='$comment_link'";
$db->query($sql);

Last edited by Simon; 05-22-2007 at 07:47 PM.
Reply With Quote
  #2 (permalink)  
Old 05-22-2007, 08:50 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
I think you refer to this and is alredy mentioned at http://forums.pligg.com/showpost.php...01&postcount=4
Reply With Quote
  #3 (permalink)  
Old 05-27-2007, 07:50 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 537
It's something more than that. I made that change, along with a re-calculation of the comment number when posting a new comment to minimise errors. However, I just posted a new comment in a pligg installation, and when I returned to the front page, several other stories (random seemingly) had their comment count reset to zero. Very strange...

The other bug is that when a story gets published, its comment count is also reset to zero. Does anyone know where resets like this could be occuring?
Reply With Quote
  #4 (permalink)  
Old 05-27-2007, 09:47 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
This is very strange - I will comment on it after I could confirm on this issue. Is that this happens only on 9.5 or older ones too?
Reply With Quote
  #5 (permalink)  
Old 06-01-2007, 10:45 PM
New Pligger
 
Join Date: May 2007
Posts: 17
This seems to be happening to me, as well. I've just installed the latest Pligg and have my first thread to reach three comments. I posted the third comment and revisited the home page, only to notice that the comment count is at 1.

I'll continue watching to see if all stories with comments behave this way ... And is it only triggered by comment #3?
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Story Comment Count not working aaronpais Questions and Comments 6 04-12-2010 03:14 PM
9.8.1 upgrade: comment count not showing up nothingman Questions and Comments 2 02-21-2008 11:01 PM
Voting resets comment count to zero (b9.6) Simon Questions and Comments 7 06-22-2007 10:01 PM
Reducing query count in comments revenazb Questions and Comments 5 04-17-2007 01:37 AM
story comment count daone Questions and Comments 0 03-06-2007 11:11 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development