Changeset 5419 for trunk/bp-activity/bp-activity-admin.php
- Timestamp:
- 11/30/2011 07:32:53 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-admin.php
r5408 r5419 492 492 ) ); 493 493 494 // If we're viewing a specific activity, flatten all activites into a single array. 495 if ( $include_id ) { 496 $activities['activities'] = BP_Activity_List_Table::flatten_activity_array( $activities['activities'] ); 497 $activities['total'] = count( $activities['activities'] ); 498 499 // Sort the array by the activity object's date_recorded value 500 usort( $activities['activities'], create_function( '$a, $b', 'return $a->date_recorded > $b->date_recorded;' ) ); 501 } 502 494 503 // bp_activity_get returns an array of objects; cast these to arrays for WP_List_Table. 495 504 $new_activities = array(); … … 500 509 $this->activity_user_id[$activity_item->id] = $activity_item->user_id; 501 510 } 502 503 // @todo If we're viewing a specific activity, check/merge $activity->children into the main list (recursive).504 /*if ( $include_id ) {505 }*/506 511 507 512 // Set raw data to display … … 871 876 } 872 877 } 878 879 /** 880 * Helper function to flatten all activites returned from bp_activity_get() into a single array. 881 * 882 * @param array $tree Source array 883 * @return array Flattened array 884 * @since 1.6 885 */ 886 public static function flatten_activity_array( $tree ){ 887 foreach ( (array) $tree as $node ) { 888 if ( isset( $node->children ) ) { 889 890 foreach ( BP_Activity_List_Table::flatten_activity_array( $node->children ) as $child ) { 891 $tree[] = $child; 892 } 893 894 unset( $node->children ); 895 } 896 } 897 898 return $tree; 899 } 873 900 } 874 901 ?>
Note: See TracChangeset
for help on using the changeset viewer.