bp_blogs_post_type_comments_avoid_duplicates( int $retval )

Limit the display of post type synced comments.

Description

Parameters

$retval

(int) (Required) The comment count for the activity.

Return

(int) The comment count, or 0 to hide activity comment replies.

Source

File: bp-blogs/bp-blogs-activity.php

function bp_blogs_post_type_comments_avoid_duplicates( $retval ) {
	/**
	 * Only limit the display when Post type comments are synced with
	 * activity comments.
	 */
	if ( bp_disable_blogforum_comments() ) {
		return $retval;
	}

	if ( 'activity_comment' !== bp_get_activity_type() ) {
		return $retval;
	}

	// Check the parent activity
	$parent_activity = new BP_Activity_Activity( bp_get_activity_item_id() );

	if ( isset( $parent_activity->type ) && bp_activity_post_type_get_tracking_arg( $parent_activity->type, 'post_type' ) ) {
		$retval = 0;
	}

	return $retval;
}

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.