Since it was asked (and on the buddypress.org forums). Mute new member activity stream registration (aka, don’t announce your spammers)
add to whatever bp-custom.php or theme functions php and define the filtered bp_has_activities() types
function my_denied_activity_new_member( $a, $activities ) {
//if admin we want to know
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
//new_member is the type name (component is 'profile')
if ( $activity->type =='new_member') {
unset( $activities->activities[$key] );
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}
/* Renumber the array keys to account for missing items */
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action('bp_has_activities','my_denied_activity_new_member', 10, 2 );
Then in your favorite theme (i’m using default) under the activity/index.php file, change up up the select option
<?php if (is_site_admin() ) : ?> <option value="new_member"><?php _e( 'Show New Members', 'buddypress' ) ?></option>--> <?php endif; ?>
I suspect you could take this a little further and check the $activity->date_recorded (ie, display new_member registration after 2 weeks)
UPDATE: I have created a simple BuddyPress Block Activity Stream Types plugin which will block any types being saved to the database.
hey I tred this on my website but no change yet
hoping for help
did you add the my_denied_activity_new_member to the theme functions.php file?
Pingback: 7 Useful Hacks and Tutorials From the Buddypress Community This Week - WordPress MU and BuddyPress plugins, themes, support, tips and how to's
updated to include a quick recount for the pagination
Bishwajeet, I think this only works for BP 1.2. Im looking for a solution for 1.1.3 as well.
Hi there
Im a bit of a noob, so need a little more help if possible…
I have a child theme, based on default theme. no real changes in my child theme…
Are you saying i should create a blank functions.php in the child theme and add your Function: “function my_denied_activity_new_member( $a, $activities ) ”
?
in that case – i would create a file called bp-custom.php and place it in the /wp-content/plugins/ directory or create your own skeleton plugin
Thanks Rich, so… to confirm:
1. Create a blank php file
2. copy/paste the following in:
function my_denied_activity_new_member( $a, $activities ) {
//if admin we want to know
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
//new_member is the type name (component is ‘profile’)
if ( $activity->type == ‘new_member’ ) {
unset( $activities->activities[$key] );
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
/* Renumber the array keys to account for missing items */
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action( ‘bp_has_activities’, ‘my_denied_activity_new_member’, 10, 2 );
3. upload to wp-content/plugins
4. activate
right?
if the bp-custom.php file no need to activate it – autoloads.
great….
so, the same for your other hacks, i can just put them in bp-custom.php
why dont you create the file and share all your hacks in one neat package? just an idea
hehehe
last question, once i have the plugin, i still need to make the change to the child theme right?
ie:
–>
Correct – these are just simple hacks that require some theme editing as well. for this one, you want to remove the “Show New Members” drop down filter (noted above)
i have requested a trac ticket on BuddyPress to include some filters/hooks. if this is done, i’ll package everything up into a nice activity management plugin (block types, disable activity-meta functions, etc). i already see the need for managing what info plugins are inserting into the activity stream.
dude. this isnt working for me. everything ive tried doesnt work. i would prefer to do it in functions.php
would you mind creating the file that works and emailing to me?
I just realized the code above with my blog template is converting into curly single/double quotes – so that is causing the issue.
would you mind emailing me the functions.php file? would really appreciate it
I posted a link to a simple plugin version
Pingback: WordPress Arena: A Blog for WordPress Developers, Designers and Bloggers
Pingback: Blog de Desenvolvimento
I tried the plugin but that didnt do anything. Adding the code in bp-custom worked fine. Thanks.
Pingback: New #BuddyPress Block Activity Stream Types plugin | the rich! ramblings
I have released a new plugin that will block any activity type from being saved to the database.
BuddyPress Block Activity Stream Types
http://blog.etiviti.com/2010/05/buddypress-block-activity-stream-types-plugin/