bp_blogs_can_comment_reply

Check if an activity comment associated with a blog post can be replied to.

Description

bp_blogs_can_comment_reply( (bool) $retval, (object|array) $comment ); 

By default, disables replying to activity comments if the corresponding buddypress/2.8.2/classes/WP" title="WP" class="code class">WP blog post no longer accepts comments.

This check uses a locally-cached value set in via .

Parameters (2)

0. $retval (bool)
Are replies allowed for this activity reply.
1. $comment (object|array)
The activity comment object.

Usage

  1. if ( !function_exists( 'bp_blogs_can_comment_reply' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-activity.php'; 
  3.  
  4. // Are replies allowed for this activity reply. 
  5. $retval = true; 
  6.  
  7. // The activity comment object. 
  8. $comment = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_blogs_can_comment_reply($retval, $comment); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-blogs/bp-blogs-activity.php  
  1. function bp_blogs_can_comment_reply( $retval, $comment ) { 
  2. if ( is_array( $comment ) ) { 
  3. $comment = (object) $comment; 
  4.  
  5. // Check comment depth and disable if depth is too large. 
  6. if ( isset(buddypress)->blogs->thread_depth[$comment->item_id] ) ) { 
  7. if ( bp_activity_get_comment_depth( $comment ) >=buddypress)->blogs->thread_depth[$comment->item_id] ) { 
  8. $retval = false; 
  9.  
  10. // Check if we should disable activity replies based on the parent activity. 
  11. if ( isset(buddypress)->blogs->allow_comments[$comment->item_id] ) ) { 
  12. // The blog post has closed off commenting, so we should disable all activity 
  13. // comments under the parent 'new_blog_post' activity entry. 
  14. if ( empty(buddypress)->blogs->allow_comments[$comment->item_id] ) ) { 
  15. $retval = false; 
  16.  
  17. return $retval;