Last active
February 5, 2022 03:45
-
-
Save KaineLabs/daa9fb0f861f5955c8923a2c743151e3 to your computer and use it in GitHub Desktop.
Youzify - BuddyPress Hide Specific Group Posts From Activity Stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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