/******* Do not edit this file *******
Woody Code Snippets CSS and JS
Saved: Apr 12 2026 | 09:22:54 */
PHP
function buddydev_friends_only_activity_args( $args ) {

	if ( ! bp_is_activity_directory() || ! is_user_logged_in() || ! empty( $args['scope'] ) ) {
		return $args;
	}

	$user_id = get_current_user_id();

	$user_ids = friends_get_friend_user_ids( $user_id );

	// include user's own too?
	array_push( $user_ids, $user_id );

	$args['user_id'] = $user_ids;

	return $args;

}
add_filter( 'bp_after_has_activities_parse_args', 'buddydev_friends_only_activity_args' );
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function buddydev_friends_only_activity_args( $args ) {
 
    if ( ! bp_is_activity_directory() || ! is_user_logged_in() || ! empty( $args['scope'] ) ) {
        return $args;
    }
 
    $user_id = get_current_user_id();
 
    $user_ids = friends_get_friend_user_ids( $user_id );
 
    // include user's own too?
    array_push( $user_ids, $user_id );
 
    $args['user_id'] = $user_ids;
 
    return $args;
 
}
add_filter( 'bp_after_has_activities_parse_args', 'buddydev_friends_only_activity_args' );