BP_Messages_Message::populate( int $id )

Set up data related to a specific message object.

Description

Parameters

$id

(Required) ID of the message.

Source

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

	public function populate( $id ) {
		global $wpdb;

		$bp = buddypress();

		if ( $message = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_messages} WHERE id = %d", $id ) ) ) {
			$this->id        = (int) $message->id;
			$this->thread_id = (int) $message->thread_id;
			$this->sender_id = (int) $message->sender_id;
			$this->subject   = $message->subject;
			$this->message   = $message->message;
			$this->date_sent = $message->date_sent;
		}
	}

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.