Changeset 5729 for trunk/bp-messages/bp-messages-classes.php
- Timestamp:
- 02/11/2012 09:32:04 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/bp-messages/bp-messages-classes.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages/bp-messages-classes.php
r5697 r5729 36 36 return false; 37 37 38 foreach ( (array) $this->messages as $key => $message )38 foreach ( (array) $this->messages as $key => $message ) 39 39 $this->sender_ids[$message->sender_id] = $message->sender_id; 40 40 … … 113 113 114 114 // Sort threads by date_sent 115 foreach( (array) $thread_ids as $thread )115 foreach( (array) $thread_ids as $thread ) 116 116 $sorted_threads[$thread->thread_id] = strtotime( $thread->date_sent ); 117 117 … … 119 119 120 120 $threads = false; 121 foreach ( (array) $sorted_threads as $thread_id => $date_sent )121 foreach ( (array) $sorted_threads as $thread_id => $date_sent ) 122 122 $threads[] = new BP_Messages_Thread( $thread_id ); 123 123 124 return array( 'threads' => &$threads, 'total' => (int) $total_threads );124 return array( 'threads' => &$threads, 'total' => (int) $total_threads ); 125 125 } 126 126 … … 210 210 $recipient_links = array(); 211 211 212 foreach ( (array) $recipients as $recipient )212 foreach ( (array) $recipients as $recipient ) 213 213 $recipient_links[] = bp_core_get_userlink( $recipient->user_id ); 214 214 … … 229 229 return true; 230 230 231 foreach( (array) $threads as $thread ) {231 foreach( (array) $threads as $thread ) { 232 232 $message_ids = maybe_unserialize( $thread->message_ids ); 233 233 … … 298 298 // If we have no thread_id then this is the first message of a new thread. 299 299 if ( empty( $this->thread_id ) ) { 300 $this->thread_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT MAX(thread_id) FROM {$bp->messages->table_name_messages}" ) ) + 1;300 $this->thread_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT MAX(thread_id) FROM {$bp->messages->table_name_messages}" ) ) + 1; 301 301 $new_thread = true; 302 302 } … … 310 310 if ( $new_thread ) { 311 311 // Add an recipient entry for all recipients 312 foreach ( (array) $this->recipients as $recipient ) {312 foreach ( (array) $this->recipients as $recipient ) { 313 313 $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $recipient->user_id, $this->thread_id ) ); 314 314 $recipient_ids[] = $recipient->user_id;
Note: See TracChangeset
for help on using the changeset viewer.