bp_activity_can_comment

Determine if a comment can be made on an activity item.

Description

bp_activity_can_comment(); 

Usage

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

Defined (1)

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

/bp-activity/bp-activity-template.php  
  1. function bp_activity_can_comment() { 
  2. global $activities_template; 
  3. $bp =buddypress); 
  4.  
  5. // Determine ability to comment based on activity type name. 
  6. $activity_type = bp_get_activity_type(); 
  7.  
  8. // Get the 'comment-reply' support for the current activity type. 
  9. $can_comment = bp_activity_type_supports( $activity_type, 'comment-reply' ); 
  10.  
  11. // Neutralize activity_comment. 
  12. if ( 'activity_comment' === $activity_type ) { 
  13. $can_comment = false; 
  14.  
  15. /** 
  16. * Filters whether a comment can be made on an activity item. 
  17. * @since 1.5.0 
  18. * @since 2.5.0 Use $activity_type instead of $activity_name for the second parameter. 
  19. * @param bool $can_comment Status on if activity can be commented on. 
  20. * @param string $activity_type Current activity type being checked on. 
  21. */ 
  22. return apply_filters( 'bp_activity_can_comment', $can_comment, $activity_type );