Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youzify - BuddyPress Hide Specific Group Posts From Activity Stream
<?php
/**
* Hide Specific Group Posts From Activity Stream for Non-Admins
**/
add_filter( 'bp_activity_get_where_conditions', 'yzc_hide_specific_group_posts_from_activity_stream' );
function yzc_hide_specific_group_posts_from_activity_stream( $where ) {
// if is an admin show all activities.
if ( is_super_admin( bp_loggedin_user_id() && bp_is_group() && bp_is_my_profile() ) ) {
return $where;
}
// List Of Forbidden Groups ID's
$forbidden_groups = array( 1 );
// Add Where Statment.
$where['hide_specific_groups'] = 'a.component = "groups" AND a.item_id NOT IN(' . implode( ',', $forbidden_groups ) . ')';
return $where;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment