1
zer0fill
NewBB Hack: Let the user decide how many new topics to view (Block)
  • 2004/6/10 11:36

  • zer0fill

  • Not too shy to talk

  • Posts: 137

  • Since: 2003/12/2


This is more for webmasters or very active members who want to see x new posts to have a chance to respond to all of them. This can also be used for aesthetic reasons: On my website, I only set it to show 5 new topics and increasing that makes the site look too "busy." This hack will allow the user to specify how many new topics to show.

./modules/newbb/blocks/newbb_new.php ~line 52
$query='SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.topic_time, t.topic_views, t.topic_replies, t.forum_id, f.forum_name FROM '.$db->prefix('bb_topics').' t, '.$db->prefix('bb_forums').' f WHERE f.forum_id=t.forum_id AND f.forum_type <> 1 ORDER BY '.$order.' DESC';
[
b]// edit start: customized block to show the default amount of topics or  x results from user input
$options[0] = (is_numeric($_GET['new_topics'])) ? intval($_GET['new_topics']) : $options[0];[/b]
// edit stop
if (!$result $db->query($query,$options[0],0)) {

./modules/newbb/templates/blocks/newbb_block_new.html ~line 48
<table cellspacing="0" cellpadding="0" border="0">
  <
tr>
<{* 
EDIT START *}>
    [
b]<td align="left" valign="top">
      <
form method="get" action="<{$xoops_requesturi}>" style="margin:0px;">
      
Display <input type="text" name="new_topics" value="<{$smarty.get.new_topics}>" size="2" maxlength="3" title="Press Enter to submit" /> new topics
      
form>
    td>[/b]
<{* 
EDIT END *}>
    <
td align="right"><a href="<{$xoops_url}>/modules/newbb/"><{$block.lang_visitforums}>a>td>
  tr>
table>

Now update the module (or edit your cloned template set) and now you'll see a small textbox like Display [¯¯] new topics. The user will type in a number, press enter on the keyboard and the page will reload with a new number of recent topics.

2
tl
Re: NewBB Hack: Let the user decide how many new topics to view (Block)
  • 2004/6/10 11:50

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


Quote:
Novice dev, expert newbie.

Well, you are doing just fine.

Login

Who's Online

323 user(s) are online (249 user(s) are browsing Support Forums)


Members: 0


Guests: 323


more...

Donat-O-Meter

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

Latest GitHub Commits