- Timestamp:
- 11/13/2021 06:40:37 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/classes/class-bp-messages-thread.php
r13112 r13147 122 122 * @type int|null $page Page of messages being requested. Default to null, meaning all. 123 123 * @type int|null $per_page Messages to return per page. Default to null, meaning all. 124 * @type string $order The order to sort the messages. Either 'ASC' or 'DESC'.124 * @type string $order Optional. The order to sort the messages. Either 'ASC' or 'DESC'. 125 125 * Defaults to 'ASC'. 126 126 * @type int|null $recipients_page Page of recipients being requested. Default to null, meaning all. … … 161 161 public function populate( $thread_id = 0, $order = 'ASC', $args = array() ) { 162 162 163 if ( ! in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ) {164 $order = 'ASC';165 }166 167 163 $user_id = 168 164 bp_displayed_user_id() ? … … 178 174 'page' => null, 179 175 'per_page' => null, 180 'order' => $order,176 'order' => bp_esc_sql_order( $order ), 181 177 'recipients_page' => null, 182 178 'recipients_per_page' => null, … … 184 180 ); 185 181 186 $this->messages_order = $ order;182 $this->messages_order = $r['order']; 187 183 $this->thread_id = (int) $thread_id; 188 184 … … 374 370 ); 375 371 376 // Fallback. 377 if ( ! in_array( strtoupper( $r['order'] ), array( 'ASC', 'DESC' ), true ) ) { 378 $r['order'] = 'ASC'; 379 } 372 // Sanitize 'order'. 373 $r['order'] = bp_esc_sql_order( $r['order'] ); 380 374 381 375 // Get messages from cache if available. … … 404 398 405 399 // Flip if order is DESC. 406 if ( 'DESC' === strtoupper( $r['order'] )) {400 if ( 'DESC' === $r['order'] ) { 407 401 $messages = array_reverse( $messages ); 408 402 }
Note: See TracChangeset
for help on using the changeset viewer.