bp_activity_can_comment_reply

Determine whether a comment can be made on an activity reply item.

Description

bp_activity_can_comment_reply( (bool) $comment = false ); 

Parameters (1)

0. $comment — Optional. (bool) => false
Activity comment.

Usage

  1. if ( !function_exists( 'bp_activity_can_comment_reply' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-template.php'; 
  3.  
  4. // Activity comment. 
  5. $comment = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_activity_can_comment_reply($comment); 
  9.  

Defined (1)

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

/bp-activity/bp-activity-template.php  
  1. function bp_activity_can_comment_reply( $comment = false ) { 
  2.  
  3. // Assume activity can be commented on. 
  4. $can_comment = true; 
  5.  
  6. // Check that comment exists. 
  7. if ( empty( $comment ) ) { 
  8.  
  9. if ( ! empty( $comment ) ) { 
  10.  
  11. // Fall back on current comment in activity loop. 
  12. $comment_depth = isset( $comment->depth ) 
  13. ? intval( $comment->depth ) 
  14.  
  15. // Threading is turned on, so check the depth. 
  16. if ( get_option( 'thread_comments' ) ) { 
  17. $can_comment = (bool) ( $comment_depth < get_option( 'thread_comments_depth' ) ); 
  18.  
  19. // No threading for comment replies if no threading for comments. 
  20. } else { 
  21. $can_comment = false; 
  22.  
  23. /** 
  24. * Filters whether a comment can be made on an activity reply item. 
  25. * @since 1.5.0 
  26. * @param bool $can_comment Status on if activity reply can be commented on. 
  27. * @param string $comment Current comment being checked on. 
  28. */ 
  29. return (bool) apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment );