bp_nouveau_ajax_search_recipients_exclude_non_friend( $results )

Exclude members from messages suggestions list if require users to be connected before they can message each other

Description

Parameters

$results

(Required)

Return

(array)

Source

File: bp-templates/bp-nouveau/includes/messages/ajax.php

function bp_nouveau_ajax_search_recipients_exclude_non_friend( $results ) {

	if ( true === bp_force_friendship_to_message() ) {
		$new_users = array();
		foreach ( $results as $user ) {
			$member_friend_status = friends_check_friendship_status( $user->user_id, bp_loggedin_user_id() );
			if ( 'is_friend' === $member_friend_status ) {
				$new_users[] = $user;
			}
		}
		return $new_users;
	}
	return $results;
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.