BBP_Forums_Group_Extension::map_activity_to_group( array $args = array() )
Map a forum post to its corresponding group in the group activity stream.
Description
Parameters
- $args
-
(Optional) Arguments from BBP_BuddyPress_Activity::record_activity()
Default value: array()
Return
(array)
Source
File: bp-forums/groups.php
public function map_activity_to_group( $args = array() ) {
// Get current BP group
$group = groups_get_current_group();
// Not posting from a BuddyBoss group? stop now!
if ( empty( $group ) )
return $args;
// Set the component to 'groups' so the activity item shows up in the group
$args['component'] = buddypress()->groups->id;
// Move the forum post ID to the secondary item ID
$args['secondary_item_id'] = $args['item_id'];
// Set the item ID to the group ID so the activity item shows up in the group
$args['item_id'] = $group->id;
// Update the group's last activity
groups_update_last_activity( $group->id );
return $args;
}
Changelog
| Version | Description |
|---|---|
| bbPress (r4396) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.