[buddypress-trac] [BuddyPress] #2340: bp_has_message_threads() broken for unique user id
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Sat Apr 24 19:46:10 UTC 2010
#2340: bp_has_message_threads() broken for unique user id
---------------------+------------------------------------------------------
Reporter: balbert | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 1.3
Component: Core | Keywords:
---------------------+------------------------------------------------------
no matter what unique user id you pass to bp_has_message_threads() only
the logged in user's messages are displayed.
Untimely get_current_threads_for_user() in bp-messages-classes.php is
broken. Although the function takes a unique $user_id, the sql calls in
the function are hard coded to use $bp->loggedin_user->id as the id.
example:
$thread_ids = $wpdb->get_results( $wpdb->prepare( "SELECT m.thread_id,
MAX(m.date_sent) AS date_sent FROM {$bp->messages->table_name_recipients}
r, {$bp->messages->table_name_messages} m WHERE m.thread_id = r.thread_id
AND r.is_deleted = 0 AND r.user_id = %d AND r.sender_only = 0 {$type_sql}
GROUP BY m.thread_id ORDER BY m.date_sent DESC {$pag_sql}",
$bp->loggedin_user->id ) );
should be:
$thread_ids = $wpdb->get_results( $wpdb->prepare( "SELECT m.thread_id,
MAX(m.date_sent) AS date_sent FROM {$bp->messages->table_name_recipients}
r, {$bp->messages->table_name_messages} m WHERE m.thread_id = r.thread_id
AND r.is_deleted = 0 AND r.user_id = %d AND r.sender_only = 0 {$type_sql}
GROUP BY m.thread_id ORDER BY m.date_sent DESC {$pag_sql}", $user_id ) );
--
Ticket URL: <http://trac.buddypress.org/ticket/2340>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list