bp_activity_can_comment_reply( bool|object $comment = false )

Determine whether a comment can be made on an activity reply item.


Description Description


Parameters Parameters

$comment

(Optional) Activity comment.

Default value: false


Top ↑

Return Return

(bool) $can_comment True if comment can receive comments, otherwise false.


Top ↑

Source Source

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

function bp_activity_can_comment_reply( $comment = false ) {

	// Assume activity can be commented on.
	$can_comment = true;

	// Check that comment exists.
	if ( empty( $comment ) ) {
		$comment = bp_activity_current_comment();
	}

	if ( ! empty( $comment ) ) {

		// Fall back on current comment in activity loop.
		$comment_depth = isset( $comment->depth )
			? intval( $comment->depth )
			: bp_activity_get_comment_depth( $comment );

		// Threading is turned on, so check the depth.
		if ( get_option( 'thread_comments' ) ) {
			$can_comment = (bool) ( $comment_depth < get_option( 'thread_comments_depth' ) );

		// No threading for comment replies if no threading for comments.
		} else {
			$can_comment = false;
		}
	}

	/**
	 * Filters whether a comment can be made on an activity reply item.
	 *
	 * @since 1.5.0
	 *
	 * @param bool   $can_comment Status on if activity reply can be commented on.
	 * @param object $comment     Current comment object being checked on.
	 */
	return (bool) apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.