how to hide admin activity on Buddypress activity?
-
when admin post on wordpress, post also appeared on BuddyPress activity, as admin’s activity.
how to prevent it? how to hide admin activity?
-
when admin post on wordpress, post also appeared on BuddyPress activity, as admin’s activity.
how to prevent it? how to hide admin activity?
Try this plugin https://buddypress.org/community/groups/buddypress-block-activity-stream-types/
also, from @sbrajesh, an alternative to the the Stealth Mode for Super Admins – Put this code in bp-custom.php and None of the site admin activity will be recorded nor will you appear in the Who is Online/ recently active members widget. –
`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
}`@igotmore There’s also this other plugin for that plugin https://wordpress.org/extend/plugins/bp-ninja/
Anyone know if this is working yet with BP 1.6 i can’t seem to figure it out.
Do you want to prevent admin activities being created in the first place, or just stop them displaying on certain screens?
If you want to stop them being displayed (and you are comfortable writing SQL) you can add a filter on bp_activity_get_user_join_filter, and modify the where clause to exclude the admin user id
If you want to stop them being created, you could add a hook on bp_activity_add, and delete the activity if the user_id is the admin id.
@rogercoathup thanks for responding sorry for the delay in my response wasn’t getting site updates for a while there. either way would be fine but I’m not very adapt at coding (sql or otherwise). id wait for an update to the plugin but we all know that goes sometimes and it seems like @francescolaffi is off on some kind of extended vacation or sabbatical. actually holding off on upgrading to 1.6 on a client site because of the issue
Did you wrap the code @mercime gave you in opening and closing php tags? Like this:
`<?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
}
?>`@shawn38 thanks for your help i figured things out after reading this post i also figured out that the plugin does work you just can’t turn it on or off using the new toolbar so what i did was using the custom file to temporarily activate the old toolbar in order to activate the ninja plugin. thanks again for all your help here and on the other topic!
Here is a solution that works in BuddyPress 1.6. This will prevent new activities from being added and will also prevent the user from showing as recently active. The first option is for admins, the second is for a specific username.
`
// Don’t record activity by the site admins or show them as recently active
function my_admin_stealth_mode(){
if ( is_site_admin() ) {
global $bp;
remove_action(‘wp_head’,’bp_core_record_activity’);
delete_user_meta($bp->loggedin_user->id, ‘last_activity’);
}
}
add_action(‘init’,’my_admin_stealth_mode’);// Don’t record activity for a user or show them as recently active
function my_user_stealth_mode(){
$current_user = wp_get_current_user();
if(is_user_logged_in()) {
if(‘YourUsername’ == $current_user->user_login) {
remove_action(‘wp_head’,’bp_core_record_activity’);
delete_user_meta($current_user->ID, ‘last_activity’);
}
}
}
add_action(‘init’,’my_user_stealth_mode’);
`@mercime Quick question about your code, i had been using BP ninja successfully but i found that the “who’s online” widget is still available on sub sites and the plugin appears to not be effective on the sub sites showing my normally invisible super admin user so now i’m looking for alternative once again.
So my question is will this code cause all admins to be invisible or just super admins? i don’t think i’d want to hide anyone who creates a site.
Also has anyone entered this as a core feature request? Seems like it would be a great addition at least to me.
@ubernaut the code provided by sbrajesh is only for Super Admin (multisite) or Site Admin (single WP) not for members who create a subsite. You’d need change is_site_admin to is_super_admin even when you use it in single WP install. is_site_admin had been deprecated some time after I posted sbrajesh’s code
I don’t recall trac ticket for this enhancement. Up to you to make a request in trac 🙂
@mercime thanks!
- The topic ‘how to hide admin activity on Buddypress activity?’ is closed to new replies.