summaryrefslogtreecommitdiff
path: root/modules/forum/forum.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/forum/forum.module')
-rw-r--r--modules/forum/forum.module8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index e4a637ce9..6dd7af988 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -121,13 +121,14 @@ function forum_link($type, $node = 0, $main = 0) {
if (!$main && $type == "node" && $node->type == "forum") {
// get previous and next topic
- $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
+ $result = db_query("SELECT n.nid, n.title, n.body, n.path, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
while ($topic = db_fetch_object($result)) {
if ($stop == 1) {
$next->nid = $topic->nid;
$next->title = $topic->title;
$next->body = $topic->body;
+ $next->path = $topic->path;
break;
}
if ($topic->nid == $node->nid) {
@@ -137,15 +138,16 @@ function forum_link($type, $node = 0, $main = 0) {
$prev->nid = $topic->nid;
$prev->title = $topic->title;
$prev->body = $topic->body;
+ $prev->path = $topic->path;
}
}
if ($prev) {
- $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."..."));
+ $links[] = l(t("previous forum topic"), node_url($prev), array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."..."));
}
if ($next) {
- $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."..."));
+ $links[] = l(t("next forum topic"), node_url($next), array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."..."));
}
}