Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/07/2015 02:07:41 PM (6 years ago)
Author:
boonebgorges
Message:

BP_Messages_Thread objects should always have last_message_* properties set.

Previously, they were only set in the context of a template loop.

Props jdgrimes.
Fixes #6580.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/classes/class-bp-messages-thread.php

    r9951 r10038  
    2929     *
    3030     * @since BuddyPress (1.0.0)
    31      * @var object
     31     * @var array
    3232     */
    3333    public $messages;
     
    3737     *
    3838     * @since BuddyPress (1.0.0)
    39      * @var object
     39     * @var array
    4040     */
    4141    public $recipients;
     
    164164            $this->messages = array_reverse( $this->messages );
    165165        }
     166
     167        $last_message_index         = count( $this->messages ) - 1;
     168        $this->last_message_id      = $this->messages[ $last_message_index ]->id;
     169        $this->last_message_date    = $this->messages[ $last_message_index ]->date_sent;
     170        $this->last_sender_id       = $this->messages[ $last_message_index ]->sender_id;
     171        $this->last_message_subject = $this->messages[ $last_message_index ]->subject;
     172        $this->last_message_content = $this->messages[ $last_message_index ]->message;
    166173
    167174        foreach ( (array) $this->messages as $key => $message ) {
Note: See TracChangeset for help on using the changeset viewer.