Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: how to add ‘extra’ data to the wire?


Burt Adsit
Participant

@burtadsit

Well, when I did this for bpgroups I just piggybacked onto the groups component. bpgroups records new topic and post activity that is directly created in bbpress. Since bp group forums was already recording the activities, I just had to simulate the same thing.

The function bp_activity_record() in bp-activity.php does the grunt work. It takes about a zillion parameters. Here’s how I did it:

$activity = array(
'item_id' => (int)$group_id,
'component_name' => 'groups',
'component_action' => 'new_forum_post',
'is_private' => 0,
'secondary_item_id' => (int)$post['post_id'],
'user_id' => (int)$post['poster_id'] );

// create a group obj that the rest of bp can use, play nice
$group_obj = new BP_Groups_Group($group_id);
groups_record_activity($activity);

groups_record_activity() in bp-groups.php takes an array param and if you look in there it eventually calls bp_activity_record()

You’ll have to figure out how to translate all the params that takes into the table colums and eventually into what you see displayed. There aren’t any docs for the activity streams as far as I know.

Skip to toolbar