bp_messages_is_message_starred( int $mid, int $user_id )

Function to determine if a message ID is starred.

Description

Parameters

$mid

(Required) The message ID. Please note that this isn't the message thread ID.

$user_id

(Required) The user ID.

Return

(bool)

Source

File: bp-messages/bp-messages-star.php

function bp_messages_is_message_starred( $mid = 0, $user_id = 0 ) {
	if ( empty( $user_id ) ) {
		$user_id = bp_displayed_user_id();
	}

	if ( empty( $mid ) ) {
		return false;
	}

	$starred = array_flip( (array) bp_messages_get_meta( $mid, 'starred_by_user', false ) );

	if ( isset( $starred[$user_id] ) ) {
		return true;
	} else {
		return false;
	}
}

Changelog

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