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 )

This entry was posted in Tech and tagged , . Bookmark the permalink.

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

  1. kunal jain says:

    Cool hack! Do you know how I can exclude member registrations from showing up in the activity feed completely?

  2. rich! says:

    look over this post on buddypress.org

    you can filter the has_activities but change the conditional check to type (from component) type name is called `new_member`

    then on your theme – under activity/index.php remove the select option for `Show New Members`

    at least in theory ;)

  3. kunal jain says:

    Thanks Ill give this a shot!

  4. Pingback: #BuddyPress Activity Stream as Blog Comments plugin | the rich! ramblings

Leave a Reply