BP_Messages_Thread::get_recipient_links( array $recipients )

Returns a string containing all the message recipient userlinks.

Description

String is comma-delimited.

If a message thread has more than four users, the returned string is simply "X Recipients" where "X" is the number of recipients in the message thread.

Parameters

$recipients

(array) (Required) Array containing the message recipients (array of objects).

Return

(string) $value String of message recipent userlinks.

Source

File: bp-messages/classes/class-bp-messages-thread.php

	public static function get_recipient_links( $recipients ) {

		if ( count( $recipients ) >= 5 ) {
			return sprintf( __( '%s Recipients', 'buddyboss' ), number_format_i18n( count( $recipients ) ) );
		}

		$recipient_links = array();

		foreach ( (array) $recipients as $recipient ) {
			$recipient_link = bp_core_get_userlink( $recipient->user_id );

			if ( empty( $recipient_link ) ) {
				$recipient_link = __( 'Deleted User', 'buddyboss' );
			}

			$recipient_links[] = $recipient_link;
		}

		return implode( ', ', (array) $recipient_links );
	}

Changelog

Changelog
Version Description
BuddyPress 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.