BP_Activity_Activity::prefetch_object_data( array $activities )

Pre-fetch data for objects associated with activity items.


Description Description

Activity items are associated with users, and often with other BuddyPress data objects. Here, we pre-fetch data about these associated objects, so that inline lookups – done primarily when building action strings – do not result in excess database queries.

The only object data required for activity component activity types (activity_update and activity_comment) is related to users, and that info is fetched separately in BP_Activity_Activity::get_activity_data(). So this method contains nothing but a filter that allows other components, such as bp-friends and bp-groups, to hook in and prime their own caches at the beginning of an activity loop.


Top ↑

Parameters Parameters

$activities

(array) (Required) Array of activities.


Top ↑

Return Return

(array) $activities Array of activities.


Source Source

File: bp-activity/classes/class-bp-activity-activity.php

	protected static function prefetch_object_data( $activities ) {

		/**
		 * Filters inside prefetch_object_data method to aid in pre-fetching object data associated with activity item.
		 *
		 * @since 2.0.0
		 *
		 * @param array $activities Array of activities.
		 */
		return apply_filters( 'bp_activity_prefetch_object_data', $activities );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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