Skip to:
Content

BuddyPress.org

Changeset 9332


Ignore:
Timestamp:
01/09/2015 07:31:32 PM (10 years ago)
Author:
r-a-y
Message:

Messages: Use INNER JOIN in BP_Messages_Thread::get_current_threads_for_user()

This commit uses INNER JOIN for compiling the SQL statement to better
prepare for meta queries with messages.

Props Mamaduka.

See #6063.

File:
1 edited

Legend:

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

    r9331 r9332  
    394394        $sql = array();
    395395        $sql['select'] = 'SELECT m.thread_id, MAX(m.date_sent) AS date_sent';
    396         $sql['from']   = "FROM {$bp->messages->table_name_recipients} r, {$bp->messages->table_name_messages} m";
    397         $sql['where']  = "WHERE m.thread_id = r.thread_id AND r.is_deleted = 0 {$user_id_sql} {$sender_sql} {$type_sql} {$search_sql}";
     396        $sql['from']   = "FROM {$bp->messages->table_name_recipients} r INNER JOIN {$bp->messages->table_name_messages} m ON m.thread_id = r.thread_id";
     397        $sql['where']  = "WHERE r.is_deleted = 0 {$user_id_sql} {$sender_sql} {$type_sql} {$search_sql}";
    398398        $sql['misc']   = "GROUP BY m.thread_id ORDER BY date_sent DESC {$pag_sql}";
    399399
Note: See TracChangeset for help on using the changeset viewer.