bp_activity_can_comment_reply( bool|object $comment = false )
Determine whether a comment can be made on an activity reply item.
Description
Parameters
- $comment
-
(Optional) Activity comment.
Default value: false
Return
(bool) $can_comment True if comment can receive comments, otherwise false.
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 BuddyPress 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 ); }
Changelog
Version | Description |
---|---|
BuddyPress 1.5.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.