Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_activity_content_body() : recent site wide posts (solved)

  • Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    I want to implement an enhanced version of recent site wide posts.

    I want to be able to exclude certain blogs (such as blog id 1), and also retrieve a thumbnail image for each post.

    The BuddyPress built in widget (recent site wide posts) uses the activities loop to fetch post information (in particular the call bp_activity_content_body () ).

    Are there any guidelines / advice for modifying / accessing the information returned by bp_activity_content_body()?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Avatar of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    Yes, use the filter on that function in a separate plugin file.

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @Andy – yes, I was going to try and delve into that filter (the one on bp_get_activity_content_body, or did you mean a different one), and I guess I need to get in to the data structures in the activities_template.

    I’m a bit confused though… I only want to return something different when it’s being used in the specific instance of fetching sitewide posts. If I add the filter, won’t it affect all uses of bp_activity_content_body?

    Avatar of cavamondo
    cavamondo
    Participant

    @cavamondo

    Did you find any solution?

    Avatar of Aomao
    aomao
    Participant

    @aomao

    Please I also need this one

    Avatar of themestown
    Themestown
    Member

    @themestown

    Not sure if it’s exactly what you’re looking for but you can try http://wordpress.org/extend/plugins/tt4bp-recent-sitewide-posts-widget/

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    We just went with a loop like this:

    `
    <?php $args = array (
    ‘action’ => ‘new_blog_post’,
    ‘max’ => 20); ?>

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

      <?php $blog_id = bp_get_activity_item_id();

      if ((int)$blog_id == 1) continue; ?>

    `

    @boonebgorges has talked about adding ‘exclude’ parameters to some of the loop functions, which could make this much neater – I don’t know the progress / state of that work

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    It’s in BP 1.3 trunk I believe.

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

You must be logged in to reply to this topic.