mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 18:01:42 +01:00
Shows pending moderation comments in title and bold comment numbers with comments that need attention.
git-svn-id: http://svn.automattic.com/wordpress/trunk@5821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
764f50bd3d
commit
51ce46e892
@ -1,109 +1,117 @@
|
|||||||
<table class="widefat">
|
<table class="widefat">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<?php foreach($posts_columns as $column_display_name) { ?>
|
<?php foreach($posts_columns as $column_display_name) { ?>
|
||||||
<th scope="col"><?php echo $column_display_name; ?></th>
|
<th scope="col"><?php echo $column_display_name; ?></th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="the-list">
|
<tbody id="the-list">
|
||||||
<?php
|
<?php
|
||||||
if ( have_posts() ) {
|
if ( have_posts() ) {
|
||||||
$bgcolor = '';
|
$bgcolor = '';
|
||||||
add_filter('the_title','wp_specialchars');
|
add_filter('the_title','wp_specialchars');
|
||||||
while (have_posts()) : the_post();
|
while (have_posts()) : the_post();
|
||||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||||
global $current_user;
|
global $current_user;
|
||||||
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
|
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
|
||||||
?>
|
?>
|
||||||
<tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>'>
|
<tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>'>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
foreach($posts_columns as $column_name=>$column_display_name) {
|
foreach($posts_columns as $column_name=>$column_display_name) {
|
||||||
|
|
||||||
switch($column_name) {
|
switch($column_name) {
|
||||||
|
|
||||||
case 'id':
|
case 'id':
|
||||||
?>
|
?>
|
||||||
<th scope="row" style="text-align: center"><?php echo $id ?></th>
|
<th scope="row" style="text-align: center"><?php echo $id ?></th>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
case 'modified':
|
case 'modified':
|
||||||
?>
|
?>
|
||||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Never'); else the_modified_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
|
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Never'); else the_modified_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
?>
|
?>
|
||||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
|
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
case 'title':
|
case 'title':
|
||||||
?>
|
?>
|
||||||
<td><?php the_title() ?>
|
<td><?php the_title() ?>
|
||||||
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
|
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'categories':
|
case 'categories':
|
||||||
?>
|
?>
|
||||||
<td><?php the_category(','); ?></td>
|
<td><?php the_category(','); ?></td>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'comments':
|
case 'comments':
|
||||||
?>
|
?>
|
||||||
<td style="text-align: center">
|
<td style="text-align: center">
|
||||||
<?php comments_number("<a href='edit.php?p=$id&c=1'>" . __('0') . '</a>', "<a href='edit.php?p=$id&c=1'>" . __('1') . '</a>', "<a href='edit.php?p=$id&c=1'>" . __('%') . '</a>') ?>
|
<?php
|
||||||
</td>
|
$left = get_pending_comments_num( $post->ID );
|
||||||
<?php
|
$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
|
||||||
break;
|
if ( $left )
|
||||||
|
echo '<strong>';
|
||||||
case 'author':
|
comments_number("<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('0') . '</a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('1') . '</a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('%') . '</a>');
|
||||||
?>
|
if ( $left )
|
||||||
<td><?php the_author() ?></td>
|
echo '</strong>';
|
||||||
<?php
|
?>
|
||||||
break;
|
</td>
|
||||||
|
<?php
|
||||||
case 'control_view':
|
break;
|
||||||
?>
|
|
||||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
|
case 'author':
|
||||||
<?php
|
?>
|
||||||
break;
|
<td><?php the_author() ?></td>
|
||||||
|
<?php
|
||||||
case 'control_edit':
|
break;
|
||||||
?>
|
|
||||||
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
case 'control_view':
|
||||||
<?php
|
?>
|
||||||
break;
|
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
|
||||||
|
<?php
|
||||||
case 'control_delete':
|
break;
|
||||||
?>
|
|
||||||
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
|
case 'control_edit':
|
||||||
<?php
|
?>
|
||||||
break;
|
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
||||||
|
<?php
|
||||||
default:
|
break;
|
||||||
?>
|
|
||||||
<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
|
case 'control_delete':
|
||||||
<?php
|
?>
|
||||||
break;
|
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
|
||||||
}
|
<?php
|
||||||
}
|
break;
|
||||||
?>
|
|
||||||
</tr>
|
default:
|
||||||
<?php
|
?>
|
||||||
endwhile;
|
<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
|
||||||
} else {
|
<?php
|
||||||
?>
|
break;
|
||||||
<tr style='background-color: <?php echo $bgcolor; ?>'>
|
}
|
||||||
<td colspan="8"><?php _e('No posts found.') ?></td>
|
}
|
||||||
</tr>
|
?>
|
||||||
<?php
|
</tr>
|
||||||
} // end if ( have_posts() )
|
<?php
|
||||||
?>
|
endwhile;
|
||||||
</tbody>
|
} else {
|
||||||
</table>
|
?>
|
||||||
|
<tr style='background-color: <?php echo $bgcolor; ?>'>
|
||||||
|
<td colspan="8"><?php _e('No posts found.') ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
} // end if ( have_posts() )
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@ -58,4 +58,11 @@ function get_comment_to_edit( $id ) {
|
|||||||
return $comment;
|
return $comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_pending_comments_num( $post_id ) {
|
||||||
|
global $wpdb;
|
||||||
|
$post_id = (int) $post_id;
|
||||||
|
$pending = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '0'" );
|
||||||
|
return $pending;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user