bp_blogs_post_type_comments_avoid_duplicates

Limit the display of post type synced comments.

Description

(int) bp_blogs_post_type_comments_avoid_duplicates( (int) $retval ); 

Returns (int)

The comment count, or 0 to hide activity comment replies.

Parameters (1)

0. $retval (int)
The comment count for the activity.

Usage

  1. if ( !function_exists( 'bp_blogs_post_type_comments_avoid_duplicates' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-activity.php'; 
  3.  
  4. // The comment count for the activity. 
  5. $retval = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_blogs_post_type_comments_avoid_duplicates($retval); 
  9.  

Defined (1)

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

/bp-blogs/bp-blogs-activity.php  
  1. function bp_blogs_post_type_comments_avoid_duplicates( $retval ) { 
  2. /** 
  3. * Only limit the display when Post type comments are synced with 
  4. * activity comments. 
  5. */ 
  6. return $retval; 
  7.  
  8. if ( 'activity_comment' !== bp_get_activity_type() ) { 
  9. return $retval; 
  10.  
  11. // Check the parent activity 
  12. $parent_activity = new BP_Activity_Activity( bp_get_activity_item_id() ); 
  13.  
  14. if ( isset( $parent_activity->type ) && bp_activity_post_type_get_tracking_arg( $parent_activity->type, 'post_type' ) ) { 
  15. $retval = 0; 
  16.  
  17. return $retval;