You are here

function privatemsg_sql_participants in Privatemsg 6

Same name and namespace in other branches
  1. 6.2 privatemsg.module \privatemsg_sql_participants()
  2. 7.2 privatemsg.module \privatemsg_sql_participants()
  3. 7 privatemsg.module \privatemsg_sql_participants()

Load all participants of a thread.

Parameters

$fragments: Query fragments array.

$thread_id: Thread id from which the participants should be loaded.

Related topics

File

./privatemsg.module, line 1284
Allows users to send private messages to other users.

Code

function privatemsg_sql_participants(&$fragments, $thread_id) {
  $fragments['primary_table'] = '{pm_index} pmi';

  // Only load each participant once since they are listed as recipient for
  // every message of that thread.
  $fragments['select'][] = 'DISTINCT(pmi.uid) AS uid';
  $fragments['select'][] = 'u.name AS name';
  $fragments['inner_join'][] = 'INNER JOIN {users} u ON (u.uid = pmi.uid)';
  $fragments['where'][] = 'pmi.thread_id = %d';
  $fragments['query_args']['where'][] = $thread_id;
}