Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to hide admin activity on Buddypress activity?


  • dodisabaruddin
    Member

    @dodisabaruddin

    when admin post on wordpress, post also appeared on BuddyPress activity, as admin’s activity.

    how to prevent it? how to hide admin activity?

Viewing 13 replies - 1 through 13 (of 13 total)

  • Virtuali
    Participant

    @gunju2221

    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/


    @mercime
    Participant

    @mercime

    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
    Member

    @igotmore

    I tried your method, mercime, but I can’t get it to work, I only got the code on the top of my site :D


    @mercime
    Participant

    @mercime

    @igotmore There’s also this other plugin for that plugin https://wordpress.org/extend/plugins/bp-ninja/


    Ben Hansen
    Participant

    @ubernaut

    Anyone know if this is working yet with BP 1.6 i can’t seem to figure it out.


    Roger Coathup
    Participant

    @rogercoathup

    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.


    Ben Hansen
    Participant

    @ubernaut

    @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 :/


    9087877
    Inactive

    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
    }
    ?>`


    Ben Hansen
    Participant

    @ubernaut

    @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!

    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-can-i-use-old-buddypress-admin-bar-if-i-dont-want-to-use-this-new-one-in-1-6/


    staceym
    Participant

    @staceym

    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’);
    `


    Ben Hansen
    Participant

    @ubernaut

    @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.


    @mercime
    Participant

    @mercime

    @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 🙂


    Ben Hansen
    Participant

    @ubernaut

    @mercime thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘how to hide admin activity on Buddypress activity?’ is closed to new replies.
Skip to toolbar