bp_activity_recurse_comments_activity_ids

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

Description

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

Returns (array)

Parameters (2)

0. $activity — Optional. (array) => array()
The activity.
1. $activity_ids — Optional. (array) => array()
Used for recursion purposes in this function.

Usage

  1. if ( !function_exists( 'bp_activity_recurse_comments_activity_ids' ) ) { 
  2. require_once '/bp-activity/bp-activity-template.php'; 
  3.  
  4. // The activity. 
  5. $activity = array(); 
  6.  
  7. // Used for recursion purposes in this function. 
  8. $activity_ids = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_activity_recurse_comments_activity_ids($activity, $activity_ids); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-activity/bp-activity-template.php  
  1. function bp_activity_recurse_comments_activity_ids( $activity = array(), $activity_ids = array() ) { 
  2. if ( is_array( $activity ) && ! empty( $activity['activities'] ) ) { 
  3. $activity = $activity['activities'][0]; 
  4.  
  5. if ( ! empty( $activity->children ) ) { 
  6. foreach ($activity->children as $child ) { 
  7. $activity_ids[] = $child->id; 
  8.  
  9. if( ! empty( $child->children ) ) { 
  10. $activity_ids = bp_activity_recurse_comments_activity_ids( $child, $activity_ids ); 
  11.  
  12. return $activity_ids;