I'm wondering what approach programmatically I should take when displaying message links that are either sent to the user loading the list, or sent out to other users.
Using some modifications to the example code listed at http://drupal.org/node/624528, I've loaded all unread and read messages regardless of author:
foreach ($query->execute() as $key => $thread) {
if ($count <= 25) {
// Generate a link with the subject as title that points to the view message page.
$items[] = array(
'data' => '<a href="' . 'messages/view/' . $thread->thread_id . '">' .
'<div class="messages-icon"></div>' .
'<div class="messages-from">' . $username . "</div>" .
'<div class="messages-subject">' . $thread->subject . "</div>" .
'<div class="messages-date">' . format_date($thread->last_updated, 'short') . "</div></a>",
'class' => array($class),
'id' => $key
);
$count++;
} else {
break;
}
and the output is done through a theme() call. I'm seeing that messages sent return null in $thread->participant. Would this be a sufficient use case to track for sent messages?