bp_activity_embed_has_activity( int $activity_id )

Query for the activity item on the activity embed template.


Description Description

Basically a wrapper for bp_has_activities(), but allows us to use the activity loop without requerying for it again.


Top ↑

Parameters Parameters

$activity_id

(int) (Required) The activity ID.


Top ↑

Return Return

(bool)


Source 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,
	) );
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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