1
Montag
[NewBB Fix] Search in NewBB
  • 2004/2/14 9:28

  • Montag

  • Just popping in

  • Posts: 9

  • Since: 2004/2/14


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>


Login

Who's Online

241 user(s) are online (158 user(s) are browsing Support Forums)


Members: 0


Guests: 241


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits