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

1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
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

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.