1

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?

2

From the page that you linked to:

// Replace 'inbox' with 'sent' to display sent messages or 'list' to display all messages.
$query = _privatemsg_assemble_query('list', $user, 'inbox');

Note that the privatemsg_filter module needs to be enabled for that to work.

  • The privatemsg_filter module is all that it's needed to display inbox and sent messages as tabs. – Druvision Nov 11 '13 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.