Forked from BoweFrankema/block-activity-types.php
Last active
February 3, 2020 11:24
-
-
Save slaFFik/044cb43c0871e48cf341 to your computer and use it in GitHub Desktop.
BuddyPress Activity - don't save certain activity types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Block certain activity types from being added | |
function bp_activity_dont_save( $activity_object ) { | |
$exclude = array( | |
'updated_profile', | |
'new_member', | |
'new_avatar', | |
'friendship_created', | |
'joined_group' | |
); | |
// 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 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment