This code snippet makes the sitewide activity stream only show updates from your friends (and by default yourself and the groups you’re a member of).
It comes in handy with big sites with lots of Buddypress activity updates.
bp-custom.php
function friends_only_activity_args($args)
	{
	if (!bp_is_activity_directory() || !is_user_logged_in())
		{
		return $args;
		}
	$user_id  = get_current_user_id();
	$user_ids = friends_get_friend_user_ids($user_id);
	// include users own too
	array_push($user_ids, $user_id);
	$args['user_id'] = $user_ids;
	return $args;
	}
add_filter('bp_after_has_activities_parse_args', 'friends_only_activity_args');
