Page 1 of 1
Deleting moderated comments
Posted: Tue Sep 14, 2004 5:42 pm
by griffinn
Just gave 0.7-beta2 a spin. Thank you for making comment moderation work in PostgreSQL.
However, when I delete a comment that's pending approval, the "comments" attribute in serendipity_entries table is decremented as if I'm deleting a published comment. If the entry so far does not have any published comments, this will give a comment count of -1 for the entry.
Posted: Tue Sep 14, 2004 5:51 pm
by tomsommer
Nice catch, will look into this ASAP.
Posted: Tue Sep 14, 2004 6:28 pm
by tomsommer
Should be fixed now, thanks

Posted: Tue Sep 21, 2004 6:08 pm
by griffinn
Oopsie, it looks like the same problem has crawled back into 0.7-beta3.
Posted: Thu Oct 21, 2004 5:11 pm
by griffinn
The same problem is still in 0.7-rc1.
I've finally gotten my act together to track it down. The glitch is in serendipity_functions.inc.php, and here's the patch.
Code: Select all
--- serendipity_functions.inc.php.good 2004-10-21 22:51:48.000000000 +0800
+++ serendipity_functions.inc.php 2004-10-21 22:52:30.000000000 +0800
@@ -1476,7 +1476,7 @@
$sql = serendipity_db_query("SELECT status FROM {$serendipity['dbPrefix']}comments
WHERE entry_id = '". (int)$entry_id ."'
AND id = '". (int)$id ."'
- $admin");
+ $admin", true);
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}comments
WHERE entry_id = '". (int)$entry_id ."'
All the patch changes is it sets $single to true explicitly when calling serendipity_db_query() to check the approval status of the comment, so that a simple associated array (not an array of an array) will be returned. (The code that follows expects $sql to be a simple array.)
I've just tried creating and deleting a few unapproved comments in my own blog, and it seems to work fine.
Posted: Fri Oct 22, 2004 7:30 pm
by tomsommer
griffinn wrote:The same problem is still in 0.7-rc1.
I've finally gotten my act together to track it down. The glitch is in serendipity_functions.inc.php, and here's the patch.
Code: Select all
--- serendipity_functions.inc.php.good 2004-10-21 22:51:48.000000000 +0800
+++ serendipity_functions.inc.php 2004-10-21 22:52:30.000000000 +0800
@@ -1476,7 +1476,7 @@
$sql = serendipity_db_query("SELECT status FROM {$serendipity['dbPrefix']}comments
WHERE entry_id = '". (int)$entry_id ."'
AND id = '". (int)$id ."'
- $admin");
+ $admin", true);
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}comments
WHERE entry_id = '". (int)$entry_id ."'
All the patch changes is it sets $single to true explicitly when calling serendipity_db_query() to check the approval status of the comment, so that a simple associated array (not an array of an array) will be returned. (The code that follows expects $sql to be a simple array.)
I've just tried creating and deleting a few unapproved comments in my own blog, and it seems to work fine.
Thanks, committed to CVS