Skip to:
Content
Pages
Categories
Search
Top
Bottom

Disable Some Activities Types


  • Leandro
    Participant

    @leandrorocha

    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 this version, since I still having new activities types from the types above being created.

    Here is the snippet that I am usimg:

    
    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 );
    }
    
  • You must be logged in to reply to this topic.
Skip to toolbar