Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/22/2011 09:33:48 PM (15 years ago)
Author:
djpaul
Message:

Create an array of user IDs for the in_array() check. Fixes #3167, props rebootnow

File:
1 edited

Legend:

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

    r4211 r4242  
    303303                        return false;
    304304
     305                $recipient_ids = array();
     306
    305307                if ( $new_thread ) {
    306308                        // Add an recipient entry for all recipients
    307                         foreach ( (array)$this->recipients as $recipient )
     309                        foreach ( (array)$this->recipients as $recipient ) {
    308310                                $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 ) );
     311                                $recipient_ids[] = $recipient->user_id;
     312                        }
    309313
    310314                        // Add a sender recipient entry if the sender is not in the list of recipients
    311                         if ( !in_array( $this->sender_id, $this->recipients ) )
     315                        if ( !in_array( $this->sender_id, $recipient_ids ) )
    312316                                $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, sender_only ) VALUES ( %d, %d, 1 )", $this->sender_id, $this->thread_id ) );
    313317                } else {
Note: See TracChangeset for help on using the changeset viewer.