Index: discussthis.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/discussthis/discussthis.module,v retrieving revision 1.3.2.7 diff -u -r1.3.2.7 discussthis.module --- discussthis.module 16 Oct 2008 13:31:53 -0000 1.3.2.7 +++ discussthis.module 19 Oct 2008 16:51:35 -0000 @@ -105,16 +105,18 @@ $topic_nid = _discussthis_get_topic($node->nid); // lookup a nid for the topic, if it exists (otherwise 0) # (optionally?) grab X most recent comments, and attach them to the node: - $result = db_query_range('SELECT c.nid, c.uid, c.name, c.subject, c.cid, c.timestamp FROM {comments} c INNER JOIN {node} n ON n.nid = c.nid WHERE c.nid = %d AND n.status = 1 AND c.status = %d ORDER BY c.cid DESC', $topic_nid, COMMENT_PUBLISHED, 0, variable_get('discussthis_comments', 10)); + if ($show_comments = variable_get('discussthis_comments',10)) { + $result = db_query_range('SELECT c.nid, c.uid, c.name, c.subject, c.cid, c.timestamp FROM {comments} c INNER JOIN {node} n ON n.nid = c.nid WHERE c.nid = %d AND n.status = 1 AND c.status = %d ORDER BY c.cid DESC', $topic_nid, COMMENT_PUBLISHED, 0, $show_comments); - while ($comment = db_fetch_object($result)) { - $comments[] = theme('discussthis_comment', $topic_nid, $comment); + while ($comment = db_fetch_object($result)) { + $comments[] = theme('discussthis_comment', $topic_nid, $comment); + } + + $node->content['discussthis_comments'] = array( + '#value' => theme('item_list', $comments), + '#weight' => 50, + ); } - - $node->content['discussthis_comments'] = array( - '#value' => theme('item_list', $comments), - '#weight' => 50, - ); } break; case 'load': @@ -341,7 +343,7 @@ $form['discussthis_comments'] = array( '#type' => 'select', '#title' => t('How many recent comments should be displayed with non-teaser node view?'), - '#options' => array(1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 10 => '10'), + '#options' => array(0 => 'none', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 10 => '10'), '#default_value' => variable_get('discussthis_comments', 10), );