'sender_id', 'hp_recipient' => 'recipient_id', 'hp_listing' => 'listing_id', 'hp_read' => 'is_read', ); /** * Returns the WordPress post_type slug handled by this interceptor. * * @return string */ protected function get_post_type(): string { return 'hp_message'; } /** * Returns the table key passed to TMDO_DB::table(). * * @return string */ protected function get_table_key(): string { return 'hpct_messages'; } /** * Builds the INSERT row for a newly created message post. * * @param int $post_id Post ID. * @param \WP_Post $post Post object. * @param string $now Formatted datetime string. * @return array{values: array, formats: array} */ protected function build_insert_data( int $post_id, \WP_Post $post, string $now ): array { return array( 'values' => array( 'post_id' => $post_id, 'thread_id' => (int) $post->post_parent, 'sender_id' => (int) $post->post_author, 'subject' => sanitize_text_field( $post->post_title ), 'body' => $post->post_content, 'status' => $post->post_status, 'sent_at' => $now, 'created_at' => $now, 'updated_at' => $now, ), 'formats' => array( '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s' ), ); } }