you can use this code buddypress has a function
place this code in function.php
function julia_b_activity_dont_save_item( &$activity ) {
$dont_types = array( 'new_member');
if ( empty( $activity->id ) && in_array( $activity->type , $dont_types ) ) {
$activity->type = '';
}
}
add_action( 'bp_activity_before_save', 'julia_b_activity_dont_save_item' );
Hi @iamdev thanks very much for the code, but I’m afraid it hasn’t worked.
I pasted it into my functions.php file in the plugins folder and nothing changed. Is there something else I should have done?
The code above has some problems.
Try this – but understand that it will not remove activity entries that have already been created. It will only prevent new items from being created going forward.
function bp_activity_do_not_save( $activity_object ) {
$exclude = array(
'updated_profile',
'new_member',
'new_avatar',
'friendship_created',
'joined_group'
);
if( in_array( $activity_object->type, $exclude ) ) {
$activity_object->type = false;
}
}
add_action('bp_activity_before_save', 'bp_activity_do_not_save', 10, 1 );
Since you only want to stop ‘new_member’ entries from being created, change $exclude
to this:
$exclude = array(
'new_member'
);
Thanks @shanebp I added the code earlier and have been waitng for some to register so I could see if it works. I’m afraid it doesn’t.
I put it in the functions.php file in the plugins folder, was that the correct place?
It should work.
Try moving it to bp-custom.php
Thanks @shanebp I added it to bp-custom.php and it worked but also seems to cause some kind of conflict.
With the code in place I’m unable to search the user database in the WP dashboard – instead of search results it displays a blank page.
Also when I tried creating a new member account to test it the activation confirmation page did not display.
I’ve now removed the code and all is working fine again.
Any ideas please?
I cannot duplicate your issues. There is something else happening on your installation.
With the code in place Iām unable to search the user database in the WP dashboard ā instead of search results it displays a blank page.
The blank page indicates an error.
You could turn on WP Debug and then try another search and then check your error log. Once you’ve generated the errors, you can turn off debug.