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.
Parameters Parameters
- $tree
-
(Required) Source array.
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; }
Changelog Changelog
Version | Description |
---|---|
1.6.0 | Introduced. |