Manage comments rework. WIP
git-svn-id: https://develop.svn.wordpress.org/trunk@6994 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
761816fa76
commit
0a28ed62e4
@ -50,8 +50,8 @@ if ( isset($_GET['comment_status']) )
|
||||
else
|
||||
$comment_status = '';
|
||||
$status_links = array();
|
||||
$num_posts = wp_count_posts('post');
|
||||
$stati = array('moderated' => __('Awaiting Moderation'), 'approved' => __('Approved'));
|
||||
$num_comments = wp_count_comments();
|
||||
$stati = array('moderated' => sprintf(__('Awaiting Moderation (%s)'), $num_comments->moderated), 'approved' => __('Approved'));
|
||||
foreach ( $stati as $status => $label ) {
|
||||
$class = '';
|
||||
|
||||
@ -74,7 +74,7 @@ unset($status_links);
|
||||
|
||||
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
|
||||
|
||||
<p><a href="?mode=view"><?php _e('View Mode') ?></a> | <a href="?mode=edit"><?php _e('Mass Edit Mode') ?></a></p>
|
||||
<p><a href="?mode=view"><?php _e('Detail View') ?></a> | <a href="?mode=edit"><?php _e('List View') ?></a></p>
|
||||
|
||||
<?php
|
||||
|
||||
@ -147,7 +147,7 @@ if ($comments) {
|
||||
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
|
||||
<td style="text-align: center; vertical-align: text-top"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
|
||||
<td style="vertical-align: text-top">
|
||||
<?php comment_author_link(); ?><br />
|
||||
<p><strong class="comment-author"><?php comment_author(); ?></strong><br />
|
||||
<?php if ( !empty($author_url) ) : ?>
|
||||
<a href="<?php echo $author_url ?>"><?php echo $author_url; ?></a> |
|
||||
<?php endif; ?>
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user