PDA

View Full Version : Last person to post in topic


TerryMason
08-06-2013, 02:33 PM
Is there a way to show the avatar of the last person who posted in a topic?

I'm able to do this with a plugin for the topic starter, using this code:


if ($thread['lastposterid']) {
require_once(DIR . '/includes/functions_user.php');
$avatarurl = fetch_avatar_url($thread['postuserid'], true);
$thread['lastposteravatar'] = $avatarurl[0] ? $avatarurl[0] : vB_Template_Runtime::fetchStylevar("imgdir_misc").'/unknown.png';
}

cellarius
08-10-2013, 10:16 AM
Change
$avatarurl = fetch_avatar_url($thread['postuserid'], true);
to
$avatarurl = fetch_avatar_url($thread['lastposterid'], true);

Amaury
08-10-2013, 03:30 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=268618" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=268618</a>

TerryMason
08-11-2013, 12:25 AM
thank you so much cellarius - that worked perfectly!

I was getting thrown because there seems to be a bit of inconsistancy:
$thread['postuserid']
$thread['lastposterid']

I just kept typing lastpostuserid, which is apparently wrong.