bp_activity_embed_has_activity( int $activity_id )
Query for the activity item on the activity embed template.
Description
Basically a wrapper for bp_has_activities(), but allows us to use the activity loop without requerying for it again.
Parameters
- $activity_id
-
(Required) The activity ID.
Return
(bool)
Source
File: bp-activity/bp-activity-embeds.php
function bp_activity_embed_has_activity( $activity_id = 0 ) { global $activities_template; if ( empty( $activity_id ) ) { return false; } if ( ! empty( $activities_template->activities ) ) { $activity = (array) $activities_template->activities; $activity = reset( $activity ); // No need to requery if we already got the embed activity if ( (int) $activity_id === $activity->id ) { return $activities_template->has_activities(); } } return bp_has_activities( array( 'display_comments' => 'threaded', 'show_hidden' => true, 'include' => (int) $activity_id, ) ); }
Changelog
Version | Description |
---|---|
BuddyPress 2.6.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.