Changeset 6994

Show
Ignore:
Timestamp:
02/23/08 08:33:44 (6 months ago)
Author:
ryan
Message:

Manage comments rework. WIP

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/edit-comments.php

    r6993 r6994  
    5151    $comment_status = ''; 
    5252$status_links = array(); 
    53 $num_posts = wp_count_posts('post'); 
    54 $stati = array('moderated' => __('Awaiting Moderation'), 'approved' => __('Approved')); 
     53$num_comments = wp_count_comments(); 
     54$stati = array('moderated' => sprintf(__('Awaiting Moderation (%s)'), $num_comments->moderated), 'approved' => __('Approved')); 
    5555foreach ( $stati as $status => $label ) { 
    5656    $class = ''; 
     
    7575<input type="hidden" name="mode" value="<?php echo $mode; ?>" /> 
    7676 
    77 <p><a href="?mode=view"><?php _e('View Mode') ?></a> | <a href="?mode=edit"><?php _e('Mass Edit Mode') ?></a></p> 
     77<p><a href="?mode=view"><?php _e('Detail View') ?></a> | <a href="?mode=edit"><?php _e('List View') ?></a></p> 
    7878 
    7979<?php 
     
    148148    <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> 
    149149    <td style="vertical-align: text-top"> 
    150     <?php comment_author_link(); ?><br /> 
     150    <p><strong class="comment-author"><?php comment_author(); ?></strong><br /> 
    151151    <?php if ( !empty($author_url) ) : ?>  
    152152    <a href="<?php echo $author_url ?>"><?php echo $author_url; ?></a> | 
  • trunk/wp-includes/comment.php

    r6853 r6994  
    445445    } 
    446446    return false; 
     447} 
     448 
     449function 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; 
    447466} 
    448467