Skip to:
Content

BuddyPress.org

Ticket #4597: 4597.diff

File 4597.diff, 1023 bytes (added by jkudish, 12 years ago)

Return the correct ID in the send() method of BP_Messages_Thread

  • bp-messages/bp-messages-classes.php

     
    365365                if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, %s )", $this->thread_id, $this->sender_id, $this->subject, $this->message, $this->date_sent ) ) )
    366366                        return false;
    367367
     368                $this->id = $wpdb->insert_id;
     369
    368370                $recipient_ids = array();
    369371
    370372                if ( $new_thread ) {
     
    382384                        $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = unread_count + 1, sender_only = 0, is_deleted = 0 WHERE thread_id = %d AND user_id != %d", $this->thread_id, $this->sender_id ) );
    383385                }
    384386
    385                 $this->id = $wpdb->insert_id;
    386387                messages_remove_callback_values();
    387388
    388389                do_action_ref_array( 'messages_message_after_save', array( &$this ) );