bp_blogs_prefetch_activity_object_data( array $activities )
Fetch data related to blogs at the beginning of an activity loop.
Description
This reduces database overhead during the activity loop.
Parameters
- $activities
-
(Required) Array of activity items.
Return
(array)
Source
File: bp-blogs/bp-blogs-activity.php
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | function bp_blogs_prefetch_activity_object_data( $activities ) { if ( empty ( $activities ) ) { return $activities ; } $blog_ids = array (); foreach ( $activities as $activity ) { if ( buddypress()->blogs->id !== $activity ->component ) { continue ; } $blog_ids [] = $activity ->item_id; } if ( ! empty ( $blog_ids ) ) { bp_blogs_update_meta_cache( $blog_ids ); } return $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.