BP_Messages_Message::get_recipient_ids( array $recipient_usernames )

Get list of recipient IDs from their usernames.


Description Description


Parameters Parameters

$recipient_usernames

(Required) Usernames of recipients.


Top ↑

Return Return

(bool|array) $recipient_ids Array of Recepient IDs.


Top ↑

Source Source

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

	public static function get_recipient_ids( $recipient_usernames ) {
		$recipient_ids = false;

		if ( ! $recipient_usernames ) {
			return $recipient_ids;
		}

		if ( is_array( $recipient_usernames ) ) {
			$rec_un_count = count( $recipient_usernames );

			for ( $i = 0, $count = $rec_un_count; $i < $count; ++ $i ) {
				if ( $rid = bp_core_get_userid( trim( $recipient_usernames[ $i ] ) ) ) {
					$recipient_ids[] = $rid;
				}
			}
		}

		/**
		 * Filters the array of recipients IDs.
		 *
		 * @since 2.8.0
		 *
		 * @param array $recipient_ids Array of recipients IDs that were retrieved based on submitted usernames.
		 * @param array $recipient_usernames Array of recipients usernames that were submitted by a user.
		 */
		return apply_filters( 'messages_message_get_recipient_ids', $recipient_ids, $recipient_usernames );
	}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.