bp_blogs_can_comment_reply( bool $retval, object|array $comment )
Check if an activity comment associated with a blog post can be replied to.
Description
By default, disables replying to activity comments if the corresponding WP blog post no longer accepts comments.
This check uses a locally-cached value set in bp_blogs_disable_activity_commenting() via bp_blogs_setup_activity_loop_globals().
Parameters
- $retval
-
(Required) Are replies allowed for this activity reply.
- $comment
-
(Required) The activity comment object.
Return
(bool)
Source
File: bp-blogs/bp-blogs-activity.php
function bp_blogs_can_comment_reply( $retval, $comment ) { if ( is_array( $comment ) ) { $comment = (object) $comment; } // Check comment depth and disable if depth is too large. if ( isset( buddypress()->blogs->thread_depth[$comment->item_id] ) ){ if ( bp_activity_get_comment_depth( $comment ) >= buddypress()->blogs->thread_depth[$comment->item_id] ) { $retval = false; } } // Check if we should disable activity replies based on the parent activity. if ( isset( buddypress()->blogs->allow_comments[$comment->item_id] ) ){ // The blog post has closed off commenting, so we should disable all activity // comments under the parent 'new_blog_post' activity entry. if ( empty( buddypress()->blogs->allow_comments[$comment->item_id] ) ) { $retval = false; } } // If comments need moderation, disable activity commenting. if ( ! empty( buddypress()->blogs->comment_moderation[$comment->item_id] ) ) { $retval = false; } return $retval; }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.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.