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 Description


Parameters Parameters

$args

(Optional) Arguments from BBP_BuddyPress_Activity::record_activity()

Default value: array()


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/extend/buddypress/groups.php

	public function map_activity_to_group( $args = array() ) {

		// Get current BP group
		$group = groups_get_current_group();

		// Not posting from a BuddyPress 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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.