summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/comment-functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-11-22 09:42:38 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-11-22 09:42:38 +0000
commitfd1daa507e7a138d175a98d26fcd70c38c67c324 (patch)
treef3249c60e421dc91d5fd551e69c9f068a3d47eb9 /wp-inst/wp-includes/comment-functions.php
parentff3bf19b3af49593d927b50d5c231526159821b3 (diff)
downloadwordpress-mu-fd1daa507e7a138d175a98d26fcd70c38c67c324.tar.gz
wordpress-mu-fd1daa507e7a138d175a98d26fcd70c38c67c324.tar.xz
wordpress-mu-fd1daa507e7a138d175a98d26fcd70c38c67c324.zip
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@444 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/comment-functions.php')
-rw-r--r--wp-inst/wp-includes/comment-functions.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/wp-inst/wp-includes/comment-functions.php b/wp-inst/wp-includes/comment-functions.php
index 85f7ba1..5f52018 100644
--- a/wp-inst/wp-includes/comment-functions.php
+++ b/wp-inst/wp-includes/comment-functions.php
@@ -83,9 +83,10 @@ function wp_insert_comment($commentdata) {
$id = $wpdb->insert_id;
- if ( $comment_approved == 1)
- $wpdb->query( "UPDATE $wpdb->posts SET comment_count = comment_count + 1 WHERE ID = '$comment_post_ID'" );
-
+ if ( $comment_approved == 1) {
+ $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'");
+ $wpdb->query( "UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$comment_post_ID'" );
+ }
return $id;
}