You are here

function privatemsg_sql_privatemsg_query_settings in Privatemsg 6.2

Related topics

File

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

Code

function privatemsg_sql_privatemsg_query_settings(&$fragments, $setting, $query_ids) {
  $fragments['primary_table'] = '{pm_setting} pms';
  $fragments['select'][] = 'pms.type';
  $fragments['select'][] = 'pms.id';
  $fragments['select'][] = 'pms.value';
  $fragments['where'][] = "pms.setting = '%s'";
  $fragments['query_args']['where'][] = $setting;
  $ids_condition = array();
  foreach ($query_ids as $type => $type_ids) {
    $ids_condition[] = "pms.type = '%s' AND pms.id IN (" . db_placeholders($type_ids) . ")";
    $fragments['query_args']['where'][] = $type;
    $fragments['query_args']['where'] = array_merge($fragments['query_args']['where'], $type_ids);
  }
  $fragments['where'][] = '(' . implode(') OR (', $ids_condition) . ')';
}