2021-03-24, 05:20 PM
(This post was last modified: 2021-03-24, 05:28 PM by Baltafar. Edited 2 times in total.
Edit Reason: Forgot title lmao.
)
Hey everyone. I just stumbled upon something pretty great and i thought i'd share it before it's lost.
Open forumdisplay.php and find:
Replace it with this code:
Now in the same forumdisplay.php find:
Add this code above it:
Open Forumdisplay_thread template replace:
With this one:
Finally add this css style to your global.css:
top picture shows the avatar of the last person who replied
bottom one is the thread starter. (i didn't apply css cuz i was too lazy)
The credits goes to the author: Marcus_Avrelius
Open forumdisplay.php and find:
$query = $db->query("
SELECT t.*, {$ratingadd}t.username AS threadusername, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
WHERE t.fid='$fid' $tuseronly $tvisibleonly $datecutsql2
ORDER BY t.sticky DESC, {$t}{$sortfield} $sortordernow $sortfield2
LIMIT $start, $perpage
");
Replace it with this code:
$query = $db->query("
SELECT t.*, {$ratingadd}t.username AS threadusername, u.username, u.avatar, lp.avatar AS lpavatar
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
LEFT JOIN ".TABLE_PREFIX."users lp ON (lp.uid=t.lastposteruid) WHERE t.fid='$fid' $tuseronly $tvisibleonly $datecutsql2
ORDER BY t.sticky DESC, {$t}{$sortfield} $sortordernow $sortfield2
LIMIT $start, $perpage
");
Now in the same forumdisplay.php find:
$thread['pages'] = 0;
Add this code above it:
//avatar
if(!$thread['avatar']) {
$thread_avatar = "<a href='member.php?action=profile&uid={$thread['uid']}'><img src='images/default_avatar.gif' alt='' title='{$thread['username']}' /></a>";
}
else
{
$thread_avatar = "<a href='member.php?action=profile&uid={$thread['uid']}'><img src='{$thread['avatar']}' alt='' title='{$thread['username']}' /></a>";
}
if(!$thread['lpavatar']) {
$thread_lpavatar = "<a href='member.php?action=profile&uid={$thread['lastposteruid']}'><img src='images/default_avatar.gif' alt='' title='{$thread['lastposter']}' />";
}
else
{
$thread_lpavatar = "<a href='member.php?action=profile&uid={$thread['lastposteruid']}'><img src='{$thread['lpavatar']}' alt='' title='{$thread['lastposter']}' />";
}
//avatar end
Open Forumdisplay_thread template replace:
<div>
<span>{$prefix}{$gotounread}{$thread['threadprefix']}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>
<div class="author smalltext">{$thread['profilelink']}</div>
</div>
With this one:
<div>
<table>
<tr>
<div class="tvatar">{$thread_avatar}</div>
<div class="tvatar2">{$thread_lpavatar}</div>
<td>{$prefix}
{$gotounread}
{$thread['threadprefix']}
<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>
{$thread['multipage']}<br> {$thread['profilelink']}
</td>
</tr>
</table>
</div>
Finally add this css style to your global.css:
#tvatar img {
background-color: rgb(252, 252, 255);
padding: 2px;
border: 1px solid #a5cae4;
border-radius: 4px;
max-height: 36px;
max-width: 36px;
}
#tvatar2 img {
position: absolute;
display: block;
margin: 3px 0 0 -22px;
background-color: rgb(252, 252, 255);
border: 1px solid #a5cae4;
border-radius: 3px;
max-height: 20px;
max-width: 20px;
}
top picture shows the avatar of the last person who replied
bottom one is the thread starter. (i didn't apply css cuz i was too lazy)
The credits goes to the author: Marcus_Avrelius