bp_activity_<post_type>_pre_publish

Filters whether or not to post the activity.

Description

apply_filters( 'bp_activity_<post_type>_pre_publish', (bool) $true, (int) $blog_id, (int) $post_id, (int) $user_id ); 

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

Parameters (4)

0. $true (bool) => true
Whether or not to continue.
1. $blog_id (int)
ID of the current site.
2. $post_id (int)
ID of the current post being published.
3. $user_id (int)
ID of the current user or post author.

Usage

To run the hook, copy the example below.
  1. $true = apply_filters( 'bp_activity_{$post_type}_pre_publish', $true, $blog_id, $post_id, $user_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_publish callback 
  2. function filter_bp_activity_post_type_pre_publish( $true, $blog_id, $post_id, $user_id ) { 
  3. // make filter magic happen here... 
  4. return $true
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "bp_activity_{$post_type}_pre_publish", 'filter_bp_activity_post_type_pre_publish', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "bp_activity_{$post_type}_pre_publish", 'filter_bp_activity_post_type_pre_publish', 10, 4 ); 

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->post_type}_pre_publish", true, $blog_id, $post_id, $user_id ) ) {