How to restrict your Activity Stream to Friends Only
The BuddyPress Activity Stream records all sorts of activities within the site. In order to limit this activity stream to friends activities only, you will need to add the following code within the functions.php file of your theme:
function friends_activities($args) { if (!bp_is_activity_directory() || !is_user_logged_in()) { return $args; } $current_user_id = get_current_user_id(); $user_ids = friends_get_friend_user_ids($current_user_id); // include users own too array_push($user_ids, $current_user_id); $args['user_id'] = $user_ids; // print_r($args); return $args; }add_filter('bp_after_has_activities_parse_args', 'friends_activities');