bp_activity_can_comment()

Determine if a comment can be made on an activity item.

Description

Return

(bool) $can_comment True if item can receive comments.

Source

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

function bp_activity_can_comment() {
	global $activities_template;
	$bp = buddypress();

	// Determine ability to comment based on activity type name.
	$activity_type = bp_get_activity_type();

	// Get the 'comment-reply' support for the current activity type.
	$can_comment = bp_activity_type_supports( $activity_type, 'comment-reply' );

	// Neutralize activity_comment.
	if ( 'activity_comment' === $activity_type ) {
		$can_comment = false;
	}

	/**
	 * Filters whether a comment can be made on an activity item.
	 *
	 * @since BuddyPress 1.5.0
	 * @since BuddyPress 2.5.0 Use $activity_type instead of $activity_name for the second parameter.
	 *
	 * @param bool   $can_comment     Status on if activity can be commented on.
	 * @param string $activity_type   Current activity type being checked on.
	 */
	return apply_filters( 'bp_activity_can_comment', $can_comment, $activity_type );
}

Changelog

Changelog
Version Description
BuddyPress 1.2.0 Introduced.

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.