Skip to:
Content
Pages
Categories
Search
Top
Bottom

Controlling the Number of Latest Discussions

  • @planetphillip

    Member

    Hi,

    How can I control the number of latest discussions shown on the frontpage?

    I know I can edit the “topics shown on each page” in the config file but I just want a few topics on the frontpage and a different amount for the forums themselves.

    TIA

    Phillip

    UPDATE FROM MODERATOR (Feb 12, 2007):

    There is now a plugin for this which allows you to specify the number of topics that show up on many of bbPress’ pages:

    http://bbpress.org/plugins/topic/3

Viewing 13 replies - 1 through 13 (of 13 total)
  • @mdawaffe

    Member

    How about this plugin?

    function front_page_topics() {

    $bb->page_topics = 10;

    }

    add_action( 'bb_index.php_pre_db', 'front_page_topics' );

    @thomasw98

    Member

    I am not sure what you mean by that, as I have never created a plug-in before. Anways, I gave it a try as follows:

    Created a blank file with the following content:

    <?php

    function front_page_topics() {

    $bb->page_topics = 2;

    }

    add_action( ‘bb_index.php_pre_db’, ‘front_page_topics’ );

    ?>

    Then saved it as “latest-posts.php” and stored it in my newly created “my-plugins” folder.

    But it did not seem to have any effect as the front page of the forum would still display more that 2 latest posts (I selected to limit the topics to 2 so it would be asier to test).

    The only other thing I can think of is that this code needs to instead be added to one of the regular scripts, but I have no idea which one.

    thanks,

    thomas

    @mdawaffe

    Member

    Oops, my fault. Do exactly what you did but put

    global $bb;

    directly under the function line.

    <?php

    function front_page_topics() {

    global $bb;

    $bb->page_topics = 2;

    }

    add_action( ‘bb_index.php_pre_db’, ‘front_page_topics’ );

    ?>

    @thomasw98

    Member

    That works perfectly. Thanks!

    @planetphillip

    Member

    Works for me too. Thanks to both of you!

    NO, wait when I try to open the tags.php I recieve this message:

    Warning: Cannot modify header information - headers already sent by (output started at /home/username/public_html/forum/my-plugins/latest-topics.php:9) in /home/username/public_html/forum/bb-includes/functions.php on line 1304

    TIA

    @mdawaffe

    Member

    Make sure there is no whitespace (spaces, extra lines, tabs, etc.) before the <?php in your plugin nor after the ?>

    @planetphillip

    Member

    Thanks, you were right on the money!

    @cadre

    Member

    Would anyone happen to know if this still applies to version 0.8? I have a new forum I’d like to try this in but I thought I’d check to make sure it wouldn’t break anything first. Or is there another method that would work better?

    thanks!

    @trent

    Member

    Looking it over, I can’t see any reason why this won’t work. I guess test it out and if you get and error, just delete the plugin and report back here!

    Trent

    @mdawaffe

    Member

    That version of the plugin should work fine, but the most recent version (Front Page Topics 0.8) is a bit more configurable.

    https://bbpress.org/plugins/topic/3

    @cadre

    Member

    I tried it and everything seems to be running smoothly, thanks again for the quick response!

    @cadre

    Member

    Hey, thanks for the tip, mdawaffe. That was a breeze!

    @ardentfrost

    Member

    mdawaffe’s plugin isn’t as cool as mine

    https://bbpress.org/plugins/topic/21?replies=1

    j/k about mine being cooler, but it may work in a way that you like better ;)

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar