-
Author
-
January 12, 2016 at 16:09 #97996youratepornParticipant
Hello,
I want to put this code in my theme but dont know how.
//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 ); January 12, 2016 at 16:21 #98000sharmstrModeratorIt goes in your child theme’s functions.php file. If you’re not running a child theme (which you should be), you can use a bp-custom.php. More information on that can be found on the buddypress website: https://codex.buddypress.org/themes/bp-custom-php/
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
January 12, 2016 at 16:41 #98010youratepornParticipantThnx, but i doing something wrong?
I make a new php file and call it:
bp-custom.phpI put the code in it like this:
<?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 );
?>But its not working
January 12, 2016 at 16:44 #98011sharmstrModeratorIt wont remove those activities if they were added before you created the file. It will only stop new activities from being recorded. Is that the issue? If not, explain it better.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
January 12, 2016 at 16:46 #98013youratepornParticipantI test it right now, cancel friendship, and make friends again. But it shows up in the activety
January 12, 2016 at 16:50 #98015sharmstrModeratorwhere did you put bp-custom.php?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
January 12, 2016 at 16:51 #98016youratepornParticipantI get it, its working now. I use the code i put in here. But the code changes when i put it in here. Sorry
And thnx for helping me out. And sorry for my bad english 🙂
January 12, 2016 at 16:57 #98019sharmstrModeratorNo problem. Glad its working.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘Plugins questions’ is closed to new topics and replies.