BuddyDev

Search

[Resolved] Disable Some Activities Types

  • Participant
    Level: Initiated
    Posts: 8
    leandrotavaresrocha on #19654

    Hello,

    I am running buddypress 3.2.0 and I am being unable to disable some activities from the activity feed. I would like to hide activites like new_avatar or joined_group, but my code seems not being working with 3.2 or newer. Even with the code bellow in my function.php I still with the activity type being created in my feed.

    Here is the snippet that I am using:

    if( bp_is_active(‘activity’) ) {
    // https://buddypress.org/support/topic/block-activity-stream-types/
    // Filter activities from update activity stream
    function imath_activity_dont_save( $activity_object ) {
    $exclude = array( ‘joined_group’, ‘new_avatar’ , ‘updated_profile’, ‘created_group’, ‘friendship_created’, ‘new_shop_purchase’);
    // 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’, ‘imath_activity_dont_save’, 10, 1 );
    }

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #19681

    Hi,
    I had posted something similar a few years ago.

    Give it a try from here

    https://buddydev.com/disallowing-activity-recording-for-components-or-some-activity-types-in-buddypress/

    and let me know if it works or not?

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved