BP_Activity_List_Table::flatten_activity_array( array $tree )
Flatten the activity array.
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
- $tree
-
(Required) Source array.
Return
(array) Flattened array.
Source
File: bp-activity/classes/class-bp-activity-list-table.php
923 924 925 926 927 928 929 930 931 932 933 934 935 936 | 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
Version | Description |
---|---|
BuddyPress 1.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.