Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Bug in /forum/viewthread.php post# redirecting wrong.


Print Track
After fiddling with RSS where I discovered that I needed to add pid to the url of the feed to go to the correct post I also found out that "post redirecting" by clicking on the #number of the post does not function properly. You only can see this problem if you click on a post# when it is not the first page.

I examined the code and the pid part was missing.
Change in viewthread.php

echo " <a href='".BASEDIR."forum/viewthread.php?forum_id=".$_GET['thread_id']."&thread_id=".$_GET['thread_id']."#post_".$data['post_id']."' name='post_".$data['post_id']."' id='post_".$data['post_id']."'>#".($current_row + $_GET['rowstart'])."</a>"; 

to
 echo " <a href='".BASEDIR."forum/viewthread.php?forum_id=".$_GET['thread_id']."&thread_id=".$_GET['thread_id']."&pid=".$data['post_id']."#post_".$data['post_id']."' name='post_".$data['post_id']."' id='post_".$data['post_id']."'>#".($current_row + $_GET['rowstart'])."</a>"; 


Full snippet with comment.

 echo "<tr>\n<td class='tbl2 forum_thread_user_name' style='width:140px'><!--forum_thread_user_name-->".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td>\n";
 echo "<td class='tbl2 forum_thread_post_date'>\n";
 echo "<div style='float:right' class='small'>";
 echo "<a href='".BASEDIR."forum/viewthread.php?forum_id=".$_GET['thread_id']."&thread_id=".$_GET['thread_id']."#top'><img src='".get_image("up")."' alt='".$locale['541']."' title='".$locale['542']."' style='border:0;vertical-align:middle' /></a>\n";
 echo " <a href='".BASEDIR."forum/viewthread.php?forum_id=".$_GET['thread_id']."&thread_id=".$_GET['thread_id']."&pid=".$data['post_id']."#post_".$data['post_id']."' name='post_".$data['post_id']."' id='post_".$data['post_id']."'>#".($current_row + $_GET['rowstart'])."</a>"; // mod Wanabo, added pid for showing the wright post and avoiding problems referring to posts.
 echo " <a href='".BASEDIR."print.php?type=F&thread=".$_GET['thread_id']."&post=".$data['post_id']."&nr=".($current_row + $_GET['rowstart'])."'><img src='".get_image("printer")."' alt='".$locale['519a']."' title='".$locale['519a']."' style='border:0;vertical-align:middle' /></a></div>\n";
 echo "<div class='small'>".$locale['505'].showdate("forumdate", $data['post_datestamp'])."</div>\n";
 echo "</td>\n";
 echo "</tr>\n<tr>\n<td valign='top' class='tbl2 forum_thread_user_info' style='width:140px'>\n";
 if ($data['user_avatar'] && file_exists(IMAGES."avatars/".$data['user_avatar']) && $data['user_status'] != 6 && $data['user_status'] != 5) {

1 reply

Thank you for the reports!
author Wanabo
forumSuspected Bugs and Errors - 8
replies2 posts
viewed148 times
activeLast updated on 2 months ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Falk, Wanabo