BP_Activity_List_Table::flatten_activity_array( array $tree )

Flatten the activity array.

Description Description

In some cases, BuddyPress gives us a structured tree of activity items plus their comments. This method converts it to a flat array.

Top ↑

Parameters Parameters


(array) (Required) Source array.

Top ↑

Return Return

(array) Flattened array.

Source Source

File: bp-activity/classes/class-bp-activity-list-table.php

	public static function flatten_activity_array( $tree ){
		foreach ( (array) $tree as $node ) {
			if ( isset( $node->children ) ) {

				foreach ( BP_Activity_List_Table::flatten_activity_array( $node->children ) as $child ) {
					$tree[] = $child;

				unset( $node->children );

		return $tree;

Top ↑

Changelog Changelog

Version Description
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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