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 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 Parameters
- $retval
-
(Required) Are replies allowed for this activity reply.
- $comment
-
(Required) The activity comment object.
Return Return
(bool)
Source 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 ( ! buddypress()->blogs->allow_comments[ $comment->item_id ] ) { $retval = false; } } // If comments need moderation, disable activity commenting. if ( isset( buddypress()->blogs->comment_moderation[ $comment->item_id ] ) && buddypress()->blogs->comment_moderation[ $comment->item_id ] ) { $retval = false; } return $retval; }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |