Page 1 of 1

Comment Deletion Bug

PostPosted: Sat Aug 11, 2012 3:20 am
by Scully
Hello

My blog only gets spam comments and as such, I delete them (they never actually appear as I have it set up so they have to be approved). Problem is, the number of comments never gets updated against an entry, so one of my entries still claims to have 80-odd comments.

I've looked into the source code and the problem appears to be in the method called deleteComments in module_comments.php - in here, it deletes the comments from the comments table, but never updates the comment_count column on the entries table.

Hopefully you can include a fix in the next release. Though, (and this will be more work) it would be nice if the number of comments shown against an entry was the number of approved comments, as this may lead to confusion if someone sees 20 comments when PivotX reckons that there are in fact 23, for example.

Take care
Scully

Re: Comment Deletion Bug

PostPosted: Sat Aug 11, 2012 10:00 am
by Harm10
I am on version 2.3.3 (MySQL) and cannot reproduce your problem. When I moderate a comment by deleting it the total number of comments displayed is lowered.
You have a point about the total number while comments are in moderation but as it is displayed together with the existing moderated comments that there are comments to be moderated you could reason that displaying the total number including those to be moderated is correct.
So on what version are you?

Re: Comment Deletion Bug

PostPosted: Sat Aug 11, 2012 2:32 pm
by Scully
I'm on the same version of PivotX. Hmm, I looked at the code on my laptop last night (not on it now, so will have to look again another time) and it seemed to run an SQL query to delete comments but not update the total on the entries.

To be fair, until I saw that bit of code last night, I'd always thought that updating the total comments remaining after deletion was flaky - meaning it sometimes seemed to work and sometimes it didn't update the total at all and sometimes it updated it, but not to the correct number. Though I wouldn't swear by that, it was just the impression I got an the code seemed to contradict that entirely.

I'll post further once I'm back on my laptop. Cheers for the reply.

Re: Comment Deletion Bug

PostPosted: Fri Oct 12, 2012 9:30 pm
by Scully
Hello Harm10

A massive delay, but I think I know what the problem is - I'm not just deleting a comment one by one, I have PivotX setup so that I have to approve comments before they are shown on my site. I then go to the moderate comments section, within admin, click select all and then delete. All the comments are deleted, but the figures within the entries table are not updated.

However, if you delete a comment one by one, the comment count is updated.

Take care
Scully

Re: Comment Deletion Bug

PostPosted: Wed Jun 26, 2013 6:39 pm
by maronno
I run into the same issue. So the only way to get the count right is to delete one at a time?

____________________________________________________________________________
Free hosting

Re: Comment Deletion Bug

PostPosted: Wed Jun 26, 2013 7:39 pm
by Harm10
I have no real clue but if the count is not right after mass deletion you can always give it the right count through sqladmin.
Sorry there is no better solution at this moment.