Changeset 4631 for trunk/wp-includes/comment.php
- Timestamp:
- 12/08/2006 07:35:45 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/comment.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r4626 r4631 431 431 } 432 432 433 if ( $wpdb->query($query) ) { 434 do_action('wp_set_comment_status', $comment_id, $comment_status); 435 436 $comment = get_comment($comment_id); 437 $comment_post_ID = $comment->comment_post_ID; 438 $c = $wpdb->get_row("SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'"); 439 if ( is_object($c) ) 440 $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'"); 441 return true; 442 } else { 433 if ( !$wpdb->query($query) ) 443 434 return false; 444 } 435 436 do_action('wp_set_comment_status', $comment_id, $comment_status); 437 $comment = get_comment($comment_id); 438 wp_update_comment_count($comment->comment_post_ID); 439 return true; 445 440 } 446 441 … … 491 486 $wpdb->query("UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$post_id'"); 492 487 $comment_count_cache[$post_id] = $count; 488 489 $post = get_post($post_id); 490 if ( 'page' == $post->post_type ) 491 clean_page_cache( $post_id ); 492 else 493 clean_post_cache( $post_id ); 494 495 do_action('edit_post', $post_id); 496 493 497 return true; 494 498 }
Note: See TracChangeset
for help on using the changeset viewer.