JP, just to let you know, you need $settings to be declared in your globals - otherwise the little post thingy icon doesn't show up I found .
Here's what I came up with. I haven't done anything really to format the output, I left it to the end user to decide how best to display the avatar. I just did the code to grab the avatar.
global $db_prefix, $txt, $user_info, $settings, $memberContext;
// If you want to limit it to one category, enter the category number here
// If you want to use all categories, set it to 0
$category = 0 ;
// Set how many posts you want to display
$limit = 5;
// If you want to limit the number of characters displayed, enter the length here
// If you want the whole post to be displayed, no matter what the length, set it to 0
$maxlength = 1000;
loadLanguage('Stats');
$result = db_query("
SELECT m.ID_BOARD, m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m, {$db_prefix}boards as b)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE m.ID_MSG = t.ID_FIRST_MSG
AND b.ID_BOARD = m.ID_BOARD
AND $user_info[query_see_board] " .
($category > 0 ? "AND ID_CAT = $category" : "")
. " ORDER BY RAND() LIMIT $limit", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result)){
if ($maxlength > 0 && strlen($row['body']) > $maxlength)
{
$row['body'] = substr($row['body'], 0, $maxlength);
while (substr($row['body'],-1) <> ' ')
$row['body'] = substr($row['body'],0,-1);
$row['body'] .= ' ...';
}
// Get the avatar...
$memberID = $row['ID_MEMBER'];
loadMemberData($memberID);
loadMemberContext($memberID);
$news['avatar'] = $memberContext[$memberID]['avatar']['image'];
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);
// Check that this message icon is there...
if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';
censorText($row['subject']);
censorText($row['body']);
$news['icon'] = '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />';
$news['subject'] = $row['subject'];
$news['time'] = timeformat($row['posterTime']);
$news['body'] = $row['body'];
$news['href'] = $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0';
$news['link'] = '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['numReplies'] . ' ' . ($row['numReplies'] == 1 ? $txt['smf_news_1'] : $txt['smf_news_2']) . '</a>';
$news['comment_link'] = !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . ';num_replies=' . $row['numReplies'] . '">' . $txt['smf_news_3'] . '</a>';
$news['poster'] = !empty($row['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>' : $row['posterName'];
$news['locked'] = !empty($row['locked']);
echo '
<div>' ,
$news['avatar'] , '
</div>
<div>
<a href="', $news['href'], '">', $news['icon'], '</a> <b>', $news['subject'], '</b>
<div class="smaller">', $news['time'], ' ', $txt[525], ' ', $news['poster'], '</div>
<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>
', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '<hr />
</div>';
}
mysql_free_result($result);
You could put some padding round the avatar maybe, split it all into two halves or whatever.