I'm trying to print inbox in a block. I initially used $thread->participants and I got an output like user_4, then I tried privatemsg_format_participants($thread->participants) and it didn't work then I used _privatemsg_format_participants($thread->participants) and still getting errors. How do I print this field?

<?php
global $user;

$header = array('Title', 'From', 'Date');

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

// Load 5 messages/threads. Replace 5 if you want to display a different amount of messages.

$list = array();
$count=0;
foreach ($query->execute() as $thread) {
  if ($count <=5) {
    // Generate a link with the subject as title that points to the view message page.
    $list[] = array(l($thread->subject, 'messages/view/'. $thread->thread_id),
                    _privatemsg_format_participants($thread->participants),
                    privatemsg_format_date($thread->last_updated),); 
    $count++;
  } else {
    break;
  }
}

// Display list as a themed item_list.

return theme('table', array('header' => $header, 'rows' => $list));
?>

Comments

ptmkenny’s picture

Status: Active » Fixed

This page on embedding may solve your problem:
https://drupal.org/node/624528

Feel free to re-open if this does not solve your issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.