BuddyPress hack: disable activity stream comments/favorites for certain types

Want to keep the noise ratio down on activity stream commenting? Besides the built-in

Disable activity stream commenting on blog and forum posts?:

I don’t see a way to implement additional filters on bp_activity_can_comment() nor is there one setup for favorites. (unless i’m not looking hard enough)

So, a quick and dirty function to block out certain activity_types.

add to whatever myhacks/functions php and define the excluded activity types

function my_denied_activity_meta_check($type) {
return in_array($type, array( 'bp_link_vote', 'friendship_created', 'friendship_accepted', 'new_forum_post', 'new_member') );
}

*we are removing the ability for voted up links, friendships, new forum posts for a group and new member registrations.

Then in your favorite theme (i’m using default) under the activity/entry.php file – add the function to the is_user_logged_in() if statement on the comment link and/or favorite link sections:

!my_denied_activity_meta_check( bp_get_activity_type() )

In this case, no comments or favorites when members add a friendship or votes up a link (from the awesome BuddyPress Links plugin)

I submitted trac tickets for BP 1.3 to include filtering on the two items (hopefully not a dup :P )


4 Responses to “BuddyPress hack: disable activity stream comments/favorites for certain types”

Leave a Reply

You must be logged in to post a comment.

You will need to register at etivite which includes access to this site for commenting.