You are here

function privatemsg_attachments_privatemsg_message_load in Privatemsg 6.2

Implements hook_privatemsg_message_load().

File

privatemsg_attachments/privatemsg_attachments.module, line 319
Allows users to add attachments to messages

Code

function privatemsg_attachments_privatemsg_message_load($message) {
  $files = array();
  $result = db_query('SELECT * FROM {files} f INNER JOIN {pm_attachments} pma ON f.fid = pma.fid WHERE pma.mid = %d ORDER BY pma.weight, f.fid', $message['mid']);
  while ($file = db_fetch_object($result)) {
    $files[$file->fid] = $file;
  }
  return array(
    'files' => $files,
  );
}