Make WordPress Core

Changeset 162


Ignore:
Timestamp:
06/04/2003 07:36:35 PM (23 years ago)
Author:
saxmatt
Message:

New comment status code.

File:
1 edited

Legend:

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

    r146 r162  
    913913}
    914914
    915 function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='') {
    916         global $id, $b2commentspopupfile, $b2commentsjavascript;
     915function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
     916        global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $tablecomments;
    917917        global $querystring_start, $querystring_equal, $querystring_separator, $siteurl;
    918         echo "<a href=\"$siteurl/";
    919         if ($b2commentsjavascript) {
    920                 echo $b2commentspopupfile.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1';
    921                 echo '" onclick="b2open(this.href); return false"';
    922         } else {
    923                 // if comments_popup_script() is not in the template, display simple comment link
    924                 comments_link();
    925                 echo '"';
    926         }
    927         if (!empty($CSSclass)) {
    928                 echo ' class="'.$CSSclass.'"';
    929         }
    930         echo '>';
    931         comments_number($zero, $one, $more);
    932         echo '</a>';
     918        $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id");
     919        if (0 == $number && 'closed' == $post->comment_status) {
     920                echo $none;
     921                return;
     922        } else {
     923                echo "<a href=\"$siteurl/";
     924                if ($b2commentsjavascript) {
     925                        echo $b2commentspopupfile.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1';
     926                        echo '\' onclick="b2open(this.href); return false"';
     927                } else {
     928                        // if comments_popup_script() is not in the template, display simple comment link
     929                        comments_link();
     930                        echo '"';
     931                }
     932                if (!empty($CSSclass)) {
     933                        echo ' class="'.$CSSclass.'"';
     934                }
     935                echo '>';
     936                comments_number($zero, $one, $more);
     937                echo '</a>';
     938        }
    933939}
    934940
Note: See TracChangeset for help on using the changeset viewer.