Skip to:
Content
Pages
Categories
Search
Top
Bottom

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

  • @bpisimone

    Participant

    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)
  • @toregus

    Participant

    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?

    @bpisimone

    Participant

    @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:

    http://site.com/profile/public/forum/topic/title/

    Instead of this:

    http://site.com/groups/group/forum/topic/title/

    @chouf1

    Participant

    Try this plugin (works with 1.1)

    https://wordpress.org/extend/plugins/bbpress-latest-discussion/

    number of post and forums can be set in plugin option

    @bpisimone

    Participant

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

    @apeatling

    Keymaster

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

    <?php if ( bp_has_activities(
    'per_page=10&
    max=10&
    object=groups&
    action=new_forum_topic,new_forum_post'
    ) ) : ?>

    <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() ?>

    </li>

    <?php endwhile; ?>

    </ul>

    <?php else: ?>

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

    <?php endif;?>

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

    @bpisimone

    Participant

    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?

    @rogercoathup

    Participant

    Andy,

    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?

    @djpaul

    Keymaster

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

    @rogercoathup

    Participant

    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

    @bpinspire

    Participant

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

    @rogercoathup

    Participant

    @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