bp_activity_<post_type>_pre_comment

Filters whether or not to post the activity about the comment.

Description

apply_filters( 'bp_activity_<post_type>_pre_comment', (bool) $true, (int) $blog_id, (int) $post_type_comment_post_id, (int) $user_id, (int) $comment_id ); 

This is a variable filter, dependent on the post type, that lets components or plugins bail early if needed.

Parameters (5)

0. $true (bool) => true
Whether or not to continue.
1. $blog_id (int)
ID of the current site.
2. $post_type_comment_post_id (int)
ID of the current post being commented.
3. $user_id (int)
ID of the current user.
4. $comment_id (int)
ID of the current comment being posted.

Usage

To run the hook, copy the example below.
  1. $true = apply_filters( 'bp_activity_{$post_type}_pre_comment', $true, $blog_id, $post_type_comment_post_id, $user_id, $comment_id ); 
  2.  
  3. if ( !empty( $true ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_activity_<post_type>_pre_comment callback 
  2. function filter_bp_activity_post_type_pre_comment( $true, $blog_id, $post_type_comment_post_id, $user_id, $comment_id ) { 
  3. // make filter magic happen here... 
  4. return $true
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "bp_activity_{$post_type}_pre_comment", 'filter_bp_activity_post_type_pre_comment', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "bp_activity_{$post_type}_pre_comment", 'filter_bp_activity_post_type_pre_comment', 10, 5 ); 

Defined (1)

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

/bp-activity/bp-activity-functions.php  
  1. if ( false === apply_filters( "bp_activity_{$post_type}_pre_comment", true, $blog_id, $post_type_comment->post->ID, $user_id, $comment_id ) ) {