Changeset 6994 for trunk/wp-includes/comment.php
- Timestamp:
- 02/23/2008 08:33:44 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/comment.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r6853 r6994 445 445 } 446 446 return false; 447 } 448 449 function wp_count_comments() { 450 global $wpdb; 451 452 $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} GROUP BY comment_approved", ARRAY_A ); 453 454 $stats = array( ); 455 $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam'); 456 foreach( (array) $count as $row_num => $row ) { 457 $stats[$approved[$row['comment_approved']]] = $row['num_comments']; 458 } 459 460 foreach ( $approved as $key ) { 461 if ( empty($stats[$key]) ) 462 $stats[$key] = 0; 463 } 464 465 return (object) $stats; 447 466 } 448 467
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)