Make WordPress Core

Changeset 5821


Ignore:
Timestamp:
07/29/2007 07:56:55 PM (17 years ago)
Author:
matt
Message:

Shows pending moderation comments in title and bold comment numbers with comments that need attention.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-post-rows.php

    r5811 r5821  
    5858        ?>
    5959        <td style="text-align: center">
    60             <?php comments_number("<a href='edit.php?p=$id&amp;c=1'>" . __('0') . '</a>', "<a href='edit.php?p=$id&amp;c=1'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1'>" . __('%') . '</a>') ?>
    61             </td>
     60        <?php
     61        $left = get_pending_comments_num( $post->ID );
     62        $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
     63        if ( $left )
     64            echo '<strong>';
     65        comments_number("<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('0') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('%') . '</a>');
     66        if ( $left )
     67            echo '</strong>';
     68        ?>
     69        </td>
    6270        <?php
    6371        break;
  • trunk/wp-admin/includes/comment.php

    r5757 r5821  
    5959}
    6060
     61function get_pending_comments_num( $post_id ) {
     62    global $wpdb;
     63    $post_id = (int) $post_id;
     64    $pending = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '0'" );
     65    return $pending;
     66}
     67
    6168?>
Note: See TracChangeset for help on using the changeset viewer.