Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Topic closed
Deleting a comment doesn't update the parent's comment count
In Textpattern · 4.0.1 deleting a comment does not correctly update the comment count of the parent.
In txp_misc.php :
<pre>
function update_comments_count($id)
{
$thecount = safe_field(‘count(*)’,‘txp_discuss’,‘parentid=’.doSlash($id).’ and visible=1’);
This means that the $id passed in is the parent id…
In txp_discuss, however:
<pre>
function discuss_delete()
{
$discussid = ps(‘discussid’);
safe_delete(“txp_discuss”,“discussid = $discussid”);
update_comments_count($discussid);
discuss_list(messenger(‘message’,$discussid,‘deleted’));
}
</pre>
The comment id is passed to update_comments_count – which wouldn’t correctly update the parent’s comment count.
It should be something like this:
<pre>
function discuss_delete()
{
$discussid = ps(‘discussid’);
Last edited by ebullient (2005-10-16 20:18:25)
‘Waste of a good apple.’ – Samwise Gamgee
Offline
Re: Deleting a comment doesn't update the parent's comment count
function discuss_delete()
This is never called in the current code, IIRC.
The only way to delete comments is via multi-edit.
Can you describe how to reproduce the bug you were encountering. Does it happen on a clean install?
Offline
Re: Deleting a comment doesn't update the parent's comment count
It wasn’t a bug.. I was digging in there trying to understand how something else worked, and having _save and _delete using different IDs was not what I expected.
Consider it a code review comment.
‘Waste of a good apple.’ – Samwise Gamgee
Offline
Re: Deleting a comment doesn't update the parent's comment count
Ok, thanks. We have removed the function now so as to not cause further confusion.
Offline
Pages: 1
Topic closed