WordPress.org

Make WordPress Core

Changeset 8133


Ignore:
Timestamp:
06/20/08 14:33:52 (7 years ago)
Author:
westi
Message:

Show comment counts on the dashboard. Fixes #6471 props josephscott.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/index.php

    r7979 r8133  
    6161$num_tags = wp_count_terms('post_tag'); 
    6262 
     63$num_comm = get_comment_count( ); 
     64 
    6365$post_type_texts = array(); 
    6466 
     
    9092} 
    9193 
     94$total_comments = sprintf( __( '%1$s total' ), $num_comm['total_comments'] ); 
     95$approved_comments = sprintf( __( '%1$s approved' ), $num_comm['approved'] ); 
     96$spam_comments = sprintf( __( '%1$s spam' ), $num_comm['spam'] ); 
     97$moderated_comments = sprintf( __( '%1$s awaiting moderation' ), $num_comm['awaiting_moderation'] ); 
     98 
     99if( current_user_can( 'moderate_comments' ) ) { 
     100    $total_comments = "<a href='edit-comments.php'>{$total_comments}</a>"; 
     101    $approved_comments = "<a href='edit-comments.php?comment_status=approved'>{$approved_comments}</a>"; 
     102    $moderated_comments = "<a href='edit-comments.php?comment_status=moderated'>{$moderated_comments}</a>"; 
     103} 
     104 
     105$comm_text = sprintf( __( 'Current comment break down: %1$s, %2$s, %3$s and %4$s.' ), $total_comments, $approved_comments, $spam_comments, $moderated_comments ); 
     106 
    92107$post_type_text = implode(', ', $post_type_texts); 
    93108 
    94109// There is always a category 
    95 $sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s' ), $post_type_text, $cats_text, $tags_text, $pending_text ); 
    96 $sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text ); 
     110$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s %5$s' ), $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text ); 
     111$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text ); 
    97112 
    98113?> 
Note: See TracChangeset for help on using the changeset viewer.