BP_Messages_Thread::update_last_message_status( $data )

Update the thread’s deleted recipient and set the message deletion status

Description

Parameters

$thread_id

(Required)

Source

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

	public static function update_last_message_status( $data ) {
		extract( $data );

		if ( ! $deleted_recipients ) {
			return;
		}

		if ( ! $last_message ) {
			return;
		}

		foreach ( $deleted_recipients as $recipient ) {
			// use add to allow multiple values
			bp_messages_add_meta( $last_message->id, 'deleted_by', $recipient->user_id );
		}

		global $wpdb;
		$bp = buddypress();

		$wpdb->query( $wpdb->prepare( "
			UPDATE {$bp->messages->table_name_recipients}
			SET is_deleted = 0
			WHERE thread_id = %d
			AND user_id IN (%s)
		", $thread_id, implode( ',', wp_list_pluck( $deleted_recipients, 'user_id' ) ) ) );
	}

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.