bp_activity_recurse_comments_activity_ids( array $activity = array(), array $activity_ids = array() )

Recurse through all activity comments and return the activity comment IDs.

Description

Parameters

$activity

(Optional) Array of activities generated from bp_activity_get().

Default value: array()

$activity_ids

(Optional) Used for recursion purposes in this function.

Default value: array()

Return

(array)

Source

File: bp-activity/bp-activity-template.php

function bp_activity_recurse_comments_activity_ids( $activity = array(), $activity_ids = array() ) {
	if ( is_array( $activity ) && ! empty( $activity['activities'] ) ) {
		$activity = $activity['activities'][0];
	}

	if ( ! empty( $activity->children ) ) {
		foreach ($activity->children as $child ) {
			$activity_ids[] = $child->id;

			if( ! empty( $child->children ) ) {
				$activity_ids = bp_activity_recurse_comments_activity_ids( $child, $activity_ids );
			}
		}
	}

	return $activity_ids;
}

Changelog

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.