Skip to content

Instantly share code, notes, and snippets.

@imath
Created July 19, 2021 05:35
Show Gist options
  • Save imath/8708a5137cf3cc94189144c0f578c654 to your computer and use it in GitHub Desktop.
Save imath/8708a5137cf3cc94189144c0f578c654 to your computer and use it in GitHub Desktop.
Latest Activities BP Block filter: use this filter to disable the Post activity about the Post being displayed.
<?php
/**
* Use this filter to disable the Post activity about the Post being displayed.
*/
function test_bp_activity_block_latest_updates_args( $widget_args, $block_args ) {
$actions = explode( ',', $widget_args['action'] );
if ( isset( $block_args['postId'] ) && $block_args['postId'] && in_array( 'new_blog_post', $actions, true ) ) {
$widget_args['scope'] = false;
$widget_args['filter_query'] = array(
'relation' => 'AND',
array(
'column' => 'secondary_item_id',
'value' => (int) $block_args['postId'],
'compare' => '!=',
)
);
}
return $widget_args;
}
add_filter( 'bp_activity_block_latest_updates_args', 'test_bp_activity_block_latest_updates_args', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment