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

100
101
102
103
104
105
106
107
108
109
110
111
112
113
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.