4.7
I've created a link that fits in the $links section of my forum comments. If you're say reading comments in "General Discussions" and you want to go back to see the rest of the topics in General Discussions this is the link that will take you there.
The problem is instead of the link taking you back to:
http://www.samplesite.com/forum/3
It takes you back to:
http://www.samplesite.com/forum/tid/3
Here's a link to the screen shot:
http://www.toonopoly.com/forum2.htm
Here's the code in my Theme Template file. I put it in originally for the gallery and it works great so I thought I would add it in the forum because using the browser back button to navigate the forum is not what I want.
<?php
function next_prev($current_nid, $type, $btn_type, $label, $class) {
$query = db_query("SELECT tid FROM {term_node} WHERE nid = $current_nid;");
$tid = db_result($query);
$sql = "SELECT n.nid, n.title FROM {node} n INNER JOIN {term_node} t ON n.nid = t.nid ";
$sql .= "INNER JOIN {term_data} r ON t.tid = r.tid WHERE n.type = '".$type."' AND n.nid ";
switch ($btn_type) {
case "next":
$sql .= "< ";
break;
case "prev":
$sql .= "> ";
break;
default:
return NULL;
break;
}
$sql .= $current_nid ." AND r.tid = ". $tid ." AND n.status = 1 ORDER BY nid DESC;";