Skip to:

How Can I Show the Last 10 Forum Posts on Home.php?

  • bpisimone


    I’ve been trying to copy either the code from the forums or the group forum index into home.php with some modifications with no luck.

    Can anyone help out here?

    The main problems I had were wrong link output, pointing to user profiles instead of the posts.

Viewing 11 replies - 1 through 11 (of 11 total)

  • Tore


    I’m new to BP but I’ve learnt that some things in the code are contextually bound. Something higher up in the hierarchy may be missing.

    I’ll want to do the same thing tho. Can you explain what code you took from where?



    @Tore thanks for looking into this.

    Actually what worked best for me was just copying the code from directories/forums/forums-loop onto home.php.

    It does the same output as on the forums, but the actual link will forward to “not found” AND the group that it was posted in is not showing either.

    The link looks like this:

    Instead of this:



    Try this plugin (works with 1.1)

    number of post and forums can be set in plugin option



    Thanks Chouf1, seen it b4, still I’d like to do this without a plugin if possible!

    You can use the activity stream to pull this information and then filter it.

    <?php if ( bp_has_activities(
    ) ) : ?>

    <ul id="activity-list" class="forum-posts">

    <?php while ( bp_activities() ) : bp_the_activity(); ?>

    <li class="<?php bp_activity_css_class() ?>">

    <?php bp_activity_content() ?>


    <?php endwhile; ?>


    <?php else: ?>

    <div id="message" class="info">
    <p>No latest forum posts.</p>

    <?php endif;?>

    This will list the last 10 forum topics or forum posts site wide.



    Oh very interesting approach, thanks Andy!

    though it does not work as intended right now: I’ve got the sitewide activity widget in the sidebar, so whenever I click on a filter as groups, friends etc. your code will change as well and display the latest 10 friendships for example.

    Although the action line should prevent that right, new_forum_topic,new_forum_post?

    Roger Coathup



    I’ve tried using the code loop you’ve given above on my front page, but it doesn’t filter to just show the forum activity.

    It’s showing all the site activity, i.e. the action filter doesn’t seem to be having any effect.

    Any thoughts?

    Are you using BP 1.1.3 Roger? It might only work on BP 1.2.

    Roger Coathup


    Hi Paul,

    yes… we are on 1.1.3

    Andy’s post was 3 months ago, so I assume the code loop / bp_has_activities call was for a 1.1.x version, rather than the forthcoming 1.2.

    Any other thoughts?

    Cheers, Roger



    @Rogercoathup have you figure out the activities loop for 1.2 by chance?

    Roger Coathup


    @bpinspire – Hi, no I haven’t tried upgrading that theme to 1.2, so not sure whether the activities loop is now working. We are building a new site at the moment, but that will aggregate its forum content from an RSS feed from ‘external’ forums implemented using SimplePress

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How Can I Show the Last 10 Forum Posts on Home.php?’ is closed to new replies.
Skip to toolbar