MyBB Community Forums

Full Version: Last poster group color in threadlist
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi.

I want to colorize last poster's names on threadlist page according to the group color.

I'm using such modification on forumlist but it doesn't work on threadlist page.

That's what I tried in showthread.php:

replaced:
$lastposterlink = build_profile_link($lastposter, $lastposteruid);

with:
global $db;
                    $lastposter_query = $db->query("SELECT username, usergroup, displaygroup FROM ".TABLE_PREFIX."users WHERE uid='".$lastpost_data['lastposteruid']."'");
                       $lastposter_format = $db->fetch_array($lastposter_query);
                     $lastposter = format_name($lastposter_format['username'], $lastposter_format['usergroup'], $lastposter_format['displaygroup']); 
                    $lastpost_profilelink = build_profile_link($lastposter, $lastpost_data['lastposteruid']);

But it doesn't do anything. Is this the right file to change or just the code modification only works on forumlist?
You want to change in the actual thread, or in the thread list? The thread list is forumdisplay.php
I think this is what you're looking for (thanks to Zaher):

Quote:open forumdisplay.php
find
$thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']); 


Above it add
$query = $db->query("SELECT usergroup, displaygroup FROM ".TABLE_PREFIX."users WHERE uid='".$thread['uid']."'");
            $format = $db->fetch_array($query);
        
            $thread['username'] = format_name($thread['username'], $format['usergroup'], $format['displaygroup']); 



now find

$lastposterlink = build_profile_link($lastposter, $lastposteruid); 


Above it add
 
$lastposter_query = $db->query("SELECT usergroup, displaygroup FROM ".TABLE_PREFIX."users WHERE 
uid='".$thread['lastposteruid']."'");
            $lastposter_format = $db->fetch_array($lastposter_query);
            $lastposter = format_name($lastposter, $lastposter_format['usergroup'], $lastposter_format['displaygroup']); 
Yeah, thanks. I actually have Zaher's modification but it only affects forum listing. I want to do the same thing when you're inside a forum, where the list of threads is. That's why I thought it was the showthread.php file I must modify (which is obviously wrong). Rolleyes
I fixed it. There was a " ' " chopped from the code.

Sorry for bothering, and thanks.
Glad you figured it out. Zaher did both modifications. Wink