Changeset 5696 for trunk/bp-messages/bp-messages-classes.php
- Timestamp:
- 02/10/2012 09:02:53 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages/bp-messages-classes.php
r5302 r5696 1 1 <?php 2 3 /** 4 * BuddyPress Messages Classes 5 * 6 * @package BuddyPress 7 * @subpackage MessagesClasses 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; 4 12 5 Class BP_Messages_Thread {13 class BP_Messages_Thread { 6 14 var $thread_id; 7 15 var $messages; … … 11 19 var $unread_count; 12 20 13 function bp_messages_thread ( $thread_id = false, $order = 'ASC' ) {14 $this->__construct( $thread_id, $order);15 }16 17 21 function __construct( $thread_id = false, $order = 'ASC' ) { 18 22 if ( $thread_id ) … … 54 58 global $wpdb, $bp; 55 59 56 $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) ); 57 58 foreach ( (array)$results as $recipient ) 60 $recipients = array(); 61 $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) ); 62 63 foreach ( (array) $results as $recipient ) 59 64 $recipients[$recipient->user_id] = $recipient; 60 65 … … 203 208 return count( $recipients ) . __(' Recipients', 'buddypress'); 204 209 210 $recipient_links = array(); 211 205 212 foreach ( (array)$recipients as $recipient ) 206 213 $recipient_links[] = bp_core_get_userlink( $recipient->user_id ); … … 241 248 } 242 249 243 Class BP_Messages_Message {250 class BP_Messages_Message { 244 251 var $id; 245 252 var $thread_id; … … 251 258 var $recipients = false; 252 259 253 function bp_messages_message( $id = null ) {254 $this->__construct( $id );255 }256 257 260 function __construct( $id = null ) { 258 global $bp;259 260 261 $this->date_sent = bp_core_current_time(); 261 262 $this->sender_id = bp_loggedin_user_id(); … … 344 345 if ( is_array( $recipient_usernames ) ) { 345 346 for ( $i = 0, $count = count( $recipient_usernames ); $i < $count; ++$i ) { 346 if ( $rid = bp_core_get_userid( trim($recipient_usernames[$i]) ) ) 347 if ( $rid = bp_core_get_userid( trim($recipient_usernames[$i]) ) ) { 347 348 $recipient_ids[] = $rid; 349 } 348 350 } 349 351 } … … 376 378 var $is_active; 377 379 378 function bp_messages_notice( $id = null ) {379 $this->__construct($id);380 }381 382 380 function __construct( $id = null ) { 383 381 if ( $id ) { … … 480 478 } 481 479 } 480 482 481 ?>
Note: See TracChangeset
for help on using the changeset viewer.