BP_Messages_Thread_Template::messages()

Whether there are messages left in the loop to iterate over.

Description

This method is used by bp_thread_messages() as part of the while loop that controls iteration inside the messages loop, eg: while ( bp_thread_messages() ) { …

See also

Return

(bool) True if there are more messages to show, otherwise false.

Source

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

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
public function messages() {
    if ( ( $this->current_message + 1 ) < $this->message_count ) {
        return true;
    } elseif ( ( $this->current_message + 1 ) === $this->message_count ) {
 
        /**
         * Fires when at the end of messages to iterate over.
         *
         * @since BuddyPress 1.1.0
         */
        do_action( 'thread_loop_end' );
        // Do some cleaning up after the loop.
        $this->rewind_messages();
    }
 
    $this->in_the_loop = false;
    return false;
}

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.