[Resolved] Hide admin’s activities from all activity feeds in buddypress
-
I want to hide admin’s activities from all activity feeds in buddypress. I wrote custom code but its not works for me. I copy paste below two codes in wp-content/theme/mytheme/functions.php or wp-content/plugins/bp-custom.php (i was create bp-custom.php file). Kindly help me
Code1:
<?php add_action(“plugins_loaded”,”bpdev_init_sm_mode”); function bpdev_init_sm_mode(){ if(is_site_admin()) remove_action(“wp_head”,”bp_core_record_activity”); //id SM is on, remove the record activity hook } ?>
Code2:
<?php // hide admin's activities from all activity feeds function bpfr_hide_admin_activity( $a, $activities ) { // ... but allow admin to see his activities! if ( is_site_admin() ) return $activities; foreach ( $activities->activities as $key => $activity ) { // ID's to exclude, separated by commas. ID 1 is always the superadmin if ( $activity->user_id == 1 ) { unset( $activities->activities[$key] ); $activities->activity_count = $activities->activity_count-1; $activities->total_activity_count = $activities->total_activity_count-1; $activities->pag_num = $activities->pag_num -1; } } // Renumber the array keys to account for missing items $activities_new = array_values( $activities->activities ); $activities->activities = $activities_new; return $activities; } add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 ); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘[Resolved] Hide admin’s activities from all activity feeds in buddypress’ is closed to new replies.