Changeset 546 for trunk/b2-include/b2template.functions.php
- Timestamp:
- 11/12/2003 03:22:47 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r541 r546 1404 1404 // generic comments/trackbacks/pingbacks numbering 1405 1405 1406 function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments' ) {1406 function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $include_unapproved = false) { 1407 1407 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); 1409 1413 if ($number == 0) { 1410 1414 $blah = $zero; … … 1437 1441 global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash; 1438 1442 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'"); 1440 1444 if (0 == $number && 'closed' == $post->comment_status) { 1441 1445 echo $none;
Note: See TracChangeset
for help on using the changeset viewer.