Titles of unpublished nodes (which have comments) appear on the live discussions block

noid - September 23, 2006 - 19:24
Project:Live Discussion
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Prometheus6
Status:closed
Description

How do you tweak the code to correct this?

Thanks in advance!

#1

noid - September 23, 2006 - 19:45

Okay, this solution worked. Looked at the comments.module and saw that function theme_comment_block() had a "WHERE n.status = 1" condition and I added this too to the live_discussions module. In line 83 just change

// create the SQL
      $query = "SELECT c.nid, n.title, COUNT(c.nid) AS comment_count, MAX(c.timestamp) AS the_time FROM {comments} c ".
               "LEFT JOIN {node} n ON n.nid = c.nid WHERE c.status = 0 ".$select_blog." GROUP BY c.nid ORDER BY the_time DESC ".
               "LIMIT ".$commented_limit;

to

// create the SQL
      $query = "SELECT c.nid, n.title, COUNT(c.nid) AS comment_count, MAX(c.timestamp) AS the_time FROM {comments} c ".
               "LEFT JOIN {node} n ON n.nid = c.nid WHERE n.status = 1 AND c.status = 0 ".$select_blog." GROUP BY c.nid ORDER BY the_time DESC ".
               "LIMIT ".$commented_limit;

#2

Prometheus6 - October 15, 2006 - 19:28
Assigned to:Anonymous» Prometheus6
Status:active» fixed

Good catch. Thanks.

#3

Prometheus6 - October 15, 2006 - 19:29
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.