bbPress

Simple, Fast, Elegant

bbPress support forums » Troubleshooting

Controlling the Number of Latest Discussions

(14 posts)
  • Started 2 years ago by planetphillip
  • Latest reply from ardentfrost
  • This topic is resolved
  1. 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

    Posted 2 years ago #
  2. How about this plugin?

    function front_page_topics() {
    $bb->page_topics = 10;
    }
    add_action( 'bb_index.php_pre_db', 'front_page_topics' );

    Posted 2 years ago #
  3. 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

    Posted 2 years ago #
  4. 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' );

    ?>

    Posted 2 years ago #
  5. thomasw98
    Member

    That works perfectly. Thanks!

    Posted 2 years ago #
  6. 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

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

    Posted 2 years ago #
  8. Thanks, you were right on the money!

    Posted 2 years ago #
  9. 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!

    Posted 1 year ago #
  10. 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

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

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

    Posted 1 year ago #
  12. cadre
    Member

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

    Posted 1 year ago #
  13. cadre
    Member

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

    Posted 1 year ago #
  14. mdawaffe's plugin isn't as cool as mine

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

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

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.