diff --git a/modules/forum.module b/modules/forum.module index ef1f44e8c33e876998e4c004a03f71190a6d760f..de2edde3c74fa8b0725733fcc278d04aa54cd646 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -175,6 +175,7 @@ function forum_link($type, $node = 0, $main = 0) { $stop = 1; } else { + $prev = new StdClass(); $prev->nid = $topic->nid; $prev->title = $topic->title; } @@ -343,6 +344,7 @@ function _forum_format($topic) { * Array of object containing the forum information. */ function forum_get_forums($tid = 0) { + if (!$tid) { $tid = 0; } @@ -378,6 +380,8 @@ function forum_get_forums($tid = 0) { // table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria // used to join node_comment_statistics to users. $topic = db_fetch_object(db_query_range('SELECT DISTINCT(n.nid), l.last_comment_timestamp, IF(l.last_comment_uid, cu.name, l.last_comment_name) as last_comment_name, l.last_comment_uid FROM {node} n ' . node_access_join_sql() . ", {node_comment_statistics} l /*! USE INDEX (node_comment_timestamp) */, {users} cu, {term_node} r WHERE n.nid = r.nid AND r.tid = %d AND n.status = 1 AND n.type = 'forum' AND l.last_comment_uid = cu.uid AND n.nid = l.nid AND " . node_access_where_sql() . ' ORDER BY l.last_comment_timestamp DESC', $forum->tid, 0, 1)); + + $last_post = new StdClass(); $last_post->timestamp = $topic->last_comment_timestamp; $last_post->name = $topic->last_comment_name; $last_post->uid = $topic->last_comment_uid; @@ -446,6 +450,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { } if ($topic->num_comments > 0) { + $last_reply = new StdClass(); $last_reply->timestamp = $topic->last_comment_timestamp; $last_reply->name = $topic->last_comment_name; $last_reply->uid = $topic->last_comment_uid; diff --git a/modules/forum/forum.module b/modules/forum/forum.module index ef1f44e8c33e876998e4c004a03f71190a6d760f..de2edde3c74fa8b0725733fcc278d04aa54cd646 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -175,6 +175,7 @@ function forum_link($type, $node = 0, $main = 0) { $stop = 1; } else { + $prev = new StdClass(); $prev->nid = $topic->nid; $prev->title = $topic->title; } @@ -343,6 +344,7 @@ function _forum_format($topic) { * Array of object containing the forum information. */ function forum_get_forums($tid = 0) { + if (!$tid) { $tid = 0; } @@ -378,6 +380,8 @@ function forum_get_forums($tid = 0) { // table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria // used to join node_comment_statistics to users. $topic = db_fetch_object(db_query_range('SELECT DISTINCT(n.nid), l.last_comment_timestamp, IF(l.last_comment_uid, cu.name, l.last_comment_name) as last_comment_name, l.last_comment_uid FROM {node} n ' . node_access_join_sql() . ", {node_comment_statistics} l /*! USE INDEX (node_comment_timestamp) */, {users} cu, {term_node} r WHERE n.nid = r.nid AND r.tid = %d AND n.status = 1 AND n.type = 'forum' AND l.last_comment_uid = cu.uid AND n.nid = l.nid AND " . node_access_where_sql() . ' ORDER BY l.last_comment_timestamp DESC', $forum->tid, 0, 1)); + + $last_post = new StdClass(); $last_post->timestamp = $topic->last_comment_timestamp; $last_post->name = $topic->last_comment_name; $last_post->uid = $topic->last_comment_uid; @@ -446,6 +450,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { } if ($topic->num_comments > 0) { + $last_reply = new StdClass(); $last_reply->timestamp = $topic->last_comment_timestamp; $last_reply->name = $topic->last_comment_name; $last_reply->uid = $topic->last_comment_uid;