Skip to:
Content
Pages
Categories
Search
Top
Bottom

List most recent post for each topic?


  • rgilman
    Participant

    @rgilman

    How can I code an activity stream that lists only the most recent post for each topic, not all recent posts (which can include many posts from the same topic) as the standard widget does?

    I’m using bbPress 2.5.14, BuddyPress 3.20 and WordPress 4.9.8 on a local dev server so no public link to the site.

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

  • Robin W
    Moderator

    @robin-w

    If I understand it, my ‘recent activity widget’ does that

    you can find it in

    bbp style pack

    once activated you’ll find a new widget called

    (style pack) latest activity


    rgilman
    Participant

    @rgilman

    Hi Robin, thanks for your response. It looks like (style pack) latest activity gets me close and will provide a great starting point and tutorial from a bbp master.

    Apologies for the lack of clarity in my initial post. Let me explain a bit more.

    I’m developing a site that builds on Commons In A Box. You can see more about what we are doing at https://github.com/ContextInstitute/bfcom. The readme and wiki are out-of-date in the details but the general direction is right.

    We are designing for a large number of BuddyPress groups, each with its own forum. It will be a private site with access only to registered users. Most users will be involved in only a subset of the groups/forums.

    Each user will have a personalized home page/dashboard. One of the features on that dashboard will be a listing of the most recent posts/replies in topics in all of the forums to which that user belongs. So we need to start from something like groups_get_user_groups( bp_loggedin_user_id() ) and then go into something like what you do in (style pack) latest activity.

    Having (style pack) latest activity as a starting point feels like a tremendous help.

    Thank you again. 🙂


    Robin W
    Moderator

    @robin-w

    yes crack that code open it is in includes/widgets, you should find a good place to filter – probably change 159-161 – set the ‘post_parent__in’ to the forum of the current buddypress group, and the settings in the widget will be ignored.


    rgilman
    Participant

    @rgilman

    Apologies for the delay in reporting back. I was able to modify the (style pack) latest activity widget to meet my needs. Thank you!

    Along the way I found what may be a bug. On line 255, bbp_get_forum_title($forum) gets the topic title but get_the_title($forum) gets the forum title.


    Robin W
    Moderator

    @robin-w

    not sure why that would be – bbp_get_forum_title just does a check and then executes get_the_title

    the full function is

    function bbp_get_forum_title( $forum_id = 0 ) {
    		$forum_id = bbp_get_forum_id( $forum_id );
    		$title    = get_the_title( $forum_id );
    
    		return apply_filters( 'bbp_get_forum_title', $title, $forum_id );
    	}

    It seems to work fine on my test site.

    Is there a particular circumstance or is it consistently wrong on your site?

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