This topic has 3 replies, 3 voices, and was last updated 8 years by rikbutterflyskull.

  • Author
  • #101681
     hoops
    Participant

    i’ve been using this code for my other site using another theme and it works fine. however, this code didn’t work on my site with KLEO.

    this code hides blog posts and comments from the buddypress activity stream.

    COPY CODE
    remove_action( 'save_post', 'bp_blogs_record_post', 10, 2 ); 
    remove_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 ); 
    remove_action( 'wp_set_comment_status', 'bp_blogs_manage_comment', 10, 2 );
     

    any ideas and suggestions? thanks.

    #101726
     sharmstr
    Moderator

    That’s not a bug. Buddypress deprecated those in BP 2.2

    Try this

    COPY CODE
    
    //Block certain activity types from being added
    function bp_activity_dont_save( $activity_object ) {
        $exclude = array(
            'new_blog_comment',
            'new_blog_post'
        );
    
        // if the activity type is empty, it stops BuddyPress BP_Activity_Activity::save() function
        if( in_array( $activity_object->type, $exclude ) ) {
            $activity_object->type = false;
        }
    }
    
    add_action('bp_activity_before_save', 'bp_activity_dont_save', 10, 1 );
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #101739
     hoops
    Participant

    it worked! thank you very very much! 🙂

    #102108
     rikbutterflyskull
    Participant

    BuddyPress has “Site Tracking” toggle to turn on/off blog posts/comments activity record. Why not use that?

    Attachments:
    You must be logged in to view attached files.
Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘Plugins questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?