The error gone but in sent folder all avatars is (unknown.gif)
see the screen-shot for sent folder
That's my fault. After all that, it turns out my solution is wrong. There is actually an array of "to" users, so I don't know what you would want to display if the message has been sent to more than one user. But a better way to check if you are viewing the Sent folder is to check the folder id, so you could do something like this:
PHP Code:
if (THIS_SCRIPT == 'private') { require_once('./includes/functions_user.php'); if ($folderid != -1) { $avid = $pm['fromuserid']; } else { // This is the Sent folder, so find the first userid // that is not the viewing user, checking first 'cc' // then 'bcc' users. $tousers = unserialize($pm['touserarray']); if (!empty($tousers)) { $toids = (empty($tousers['cc']) ? array() : $tousers['cc']); if (!empty($tousers['bcc'])) { $toids = array_merge($toids, $tousers['bcc']); } foreach ($toids AS $id => $username) { if ($id != $vbulletin->userinfo['userid']) { $avid = $id; break; } } } } $pm[avatarurl] = fetch_avatar_url($avid); if (!$pm[avatarurl]) { $pm[avatarurl] = $stylevar['imgdir_misc'] . 'images/misc/unknown.gif'; } else { $pm[avatarurl] = $vbulletin->options['bburl'] . '/' . $pm[avatarurl][0]; } }