Make WordPress Core


Ignore:
Timestamp:
11/12/2003 03:22:47 PM (22 years ago)
Author:
emc3
Message:

otaku42's comment moderation patches

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2-include/b2template.functions.php

    r541 r546  
    14041404// generic comments/trackbacks/pingbacks numbering
    14051405
    1406 function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments') {
     1406function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $include_unapproved = false) {
    14071407    global $id, $comment, $tablecomments, $querycount, $wpdb;
    1408     $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id");
     1408    $query = "SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = '$id'";
     1409    if (false == $include_unapproved) {
     1410        $query .= " AND comment_approved = '1'";
     1411    }
     1412    $number = $wpdb->get_var($query);
    14091413    if ($number == 0) {
    14101414        $blah = $zero;
     
    14371441    global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash;
    14381442    global $querystring_start, $querystring_equal, $querystring_separator, $siteurl;
    1439     $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id");
     1443    $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");
    14401444    if (0 == $number && 'closed' == $post->comment_status) {
    14411445        echo $none;
Note: See TracChangeset for help on using the changeset viewer.