Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Hide Specific Group Posts From Activity Stream
  5. **/
  6. add_filter( 'bp_activity_get_where_conditions', 'yzc_hide_specific_group_posts_from_activity_stream' );
  7.  
  8. function yzc_hide_specific_group_posts_from_activity_stream( $where ) {
  9.  
  10. // if is an admin show all activities.
  11. if ( is_super_admin( bp_loggedin_user_id() && bp_is_group() && bp_is_my_profile() ) ) {
  12. return $where;
  13. }
  14.  
  15. // List Of Forbidden Groups ID's
  16. $forbidden_groups = array( 1 );
  17.  
  18. // Add Where Statment.
  19. $where['hide_specific_groups'] = 'a.component = "groups" AND a.item_id NOT IN(' . implode( ',', $forbidden_groups ) . ')';
  20.  
  21. return $where;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement