mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Manage comments rework. WIP
git-svn-id: https://develop.svn.wordpress.org/trunk@6994 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -446,6 +446,25 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
|
||||
return false;
|
||||
}
|
||||
|
||||
function wp_count_comments() {
|
||||
global $wpdb;
|
||||
|
||||
$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} GROUP BY comment_approved", ARRAY_A );
|
||||
|
||||
$stats = array( );
|
||||
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
|
||||
foreach( (array) $count as $row_num => $row ) {
|
||||
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
|
||||
}
|
||||
|
||||
foreach ( $approved as $key ) {
|
||||
if ( empty($stats[$key]) )
|
||||
$stats[$key] = 0;
|
||||
}
|
||||
|
||||
return (object) $stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* wp_delete_comment() - Removes comment ID and maybe updates post comment count
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user