You are here

function _privatemsg_service_process_thread in Privatemsg 6.2

Enhance messages and simplify author objects for a thread.

Parameters

$thread: Privatemsg thread array.

Return value

Thread with simplified messages.

1 call to _privatemsg_service_process_thread()
privatemsg_service_get_thread in privatemsg_service/privatemsg_service.inc
Get all messages in a thread.

File

privatemsg_service/privatemsg_service.module, line 215
Link general privatemsg module functionalities to services module.

Code

function _privatemsg_service_process_thread($thread) {
  $thread['user'] = _privatemsg_service_simplify_user($thread['user']);

  // Simplify the author object of every message in this thread.
  foreach ($thread['messages'] as $mid => $message) {

    // Allow other modules to add additional information.
    $enhancements = module_invoke_all('privatemsg_service_enhance_message', $message);
    if (!empty($enhancements)) {
      $thread['messages'][$mid] = array_merge($enhancements, $message);
    }
    $thread['messages'][$mid]['author'] = _privatemsg_service_simplify_user($message['author']);
  }
  return $thread;
}