Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Excerpt function in RC2


Burt Adsit
Participant

@burtadsit

I created a function that lives in the BP_Activity_Activity class that gets recent group activity. I uploaded it as a patch in trac https://trac.buddypress.org/ticket/668

get_sitewide_activity() returns all sorts of activity not related to that group. The new function that I uploaded gets just the activity for the specified group. If you apply that patch to the bp-activity-classes.php file and build some template php around it then you’ll get your activity display.

$activity = BP_Activity_Activity::get_activity_for_group( $site_groups_template->group, 2 );

That call above would work in the group directory template file. You’ll have to build something to display the returned $activity items like the site wide activity widget does.

See bp-activity-widgets.php for a guide. This little template tag below displays some raw unformated activity.

function my_the_site_group_activity($limit = 2){

global $site_groups_template;

$activity = BP_Activity_Activity::get_activity_for_group( $site_groups_template->group, $limit );

foreach ((array)$activity as $item){

echo apply_filters( ‘bp_activity_content’, bp_activity_content_filter( $item[‘content’], $item[‘date_recorded’], ”, true, false, true ) );

}

}

You can put that fn in your bp-custom.php file and try it out. I just stuck it in a div under the description tag in groups-loop.php for testing.

Skip to toolbar