In XOOPS 2.0.6, when you do a search using the search script in the NewBB module, the results don't point to the searched posts, but only to the relative topics.
To correct this behaviour, edit /modules/newbb/search.php:
1) Change line 72:
$query = 'SELECT u.uid,f.forum_id, p.topic_id, u.uname, p.post_time,t.topic_title,t.topic_views,t.topic_replies,f.forum_name FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_posts_text').' pt, '.$xoopsDB->prefix('users').' u, '.$xoopsDB->prefix('bb_forums').' f,'.$xoopsDB->prefix('bb_topics').' t';
with:
$query = 'SELECT u.uid,f.forum_id, p.topic_id, u.uname, p.post_id,p.post_time,t.topic_title,t.topic_views,t.topic_replies,f.forum_name FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_posts_text').' pt, '.$xoopsDB->prefix('users').' u, '.$xoopsDB->prefix('bb_forums').' f,'.$xoopsDB->prefix('bb_topics').' t';
2) Change line 152:
$xoopsTpl->append('results', array('forum_name' => $myts->makeTboxData4Show($row['forum_name']), 'forum_id' => $row['forum_id'], 'topic_id' => $row['topic_id'], 'topic_title' => $myts->makeTboxData4Show($row['topic_title']), 'topic_replies' => $row['topic_replies'], 'topic_views' => $row['topic_views'], 'user_id' => $row['uid'], 'user_name' => $myts->makeTboxData4Show($row['uname']), 'post_time' => formatTimestamp($row['post_time'], "m")));
with:
$xoopsTpl->append('results', array('forum_name' => $myts->makeTboxData4Show($row['forum_name']), 'forum_id' => $row['forum_id'], 'topic_id' => $row['topic_id'], 'topic_title' => $myts->makeTboxData4Show($row['topic_title']), 'topic_replies' => $row['topic_replies'], 'topic_views' => $row['topic_views'], 'post_id' => $row['post_id'], 'user_id' => $row['uid'], 'user_name' => $myts->makeTboxData4Show($row['uname']), 'post_time' => formatTimestamp($row['post_time'], "m")));
Then edit /modules/newbb/templates/newbb_searchresults.html and change line 25:
<td class="odd"><a href="viewtopic.php?topic_id=<{$results[i].topic_id}>&forum=<{$results[i].forum_id}>"><{$results[i].topic_title}>a>td>
with:
<td class="odd"><a href="viewtopic.php?post_id=<{$results[i].post_id}>&topic_id=<{$results[i].topic_id}>&forum=<{$results[i].forum_id}>#forumpost<{$results[i].post_id}>"><{$results[i].topic_title}>a>td>