BP_Messages_Box_Template::the_message_thread()

Set up the current thread inside the loop.

Description

Used by bp_message_thread() to set up the current thread data while looping, so that template tags used during that iteration make reference to the current thread.

See also

Source

File: bp-messages/classes/class-bp-messages-box-template.php

	public function the_message_thread() {

		$this->in_the_loop = true;
		$this->thread      = $this->next_thread();

		if ( ! bp_is_current_action( 'notices' ) ) {
			$last_message_index     = 0;
			// $this->thread->messages = array_reverse( (array) $this->thread->messages );

			$this->thread->last_message_id      = $this->thread->messages[ $last_message_index ]->id;
			$this->thread->last_message_date    = $this->thread->messages[ $last_message_index ]->date_sent;
			$this->thread->last_sender_id       = $this->thread->messages[ $last_message_index ]->sender_id;
			$this->thread->last_message_subject = $this->thread->messages[ $last_message_index ]->subject;
			$this->thread->last_message_content = $this->thread->messages[ $last_message_index ]->message;
		}

		// Loop has just started.
		if ( 0 == $this->current_thread ) {

			/**
			 * Fires if at the start of the message thread loop.
			 *
			 * @since BuddyPress 1.5.0
			 */
			do_action( 'messages_box_loop_start' );
		}
	}

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.