BP_Activity_Activity::prefetch_object_data( array $activities )
Pre-fetch data for objects associated with activity items.
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.
Parameters
- $activities
-
(Required) Array of activities.
Return
(array) $activities Array of activities.
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 BuddyPress 2.0.0 * * @param array $activities Array of activities. */ return apply_filters( 'bp_activity_prefetch_object_data', $activities ); }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | 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.