Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/daa9fb0f861f5955c8923a2c743151e3 to your computer and use it in GitHub Desktop.
Save KaineLabs/daa9fb0f861f5955c8923a2c743151e3 to your computer and use it in GitHub Desktop.
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