MyBB Community Forums

Full Version: Display Avatars in Threadlist like XenForo (for MyBB)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
I am loving this tutorial, but having little trouble (not really). But in this picture, I added another column for the avatar, but I cannot get that box to fill in. Undecided
Thank you so much for this!
On Display Avatars in threadlisting like Xenforo
How to show the OTHER user avatar when he reply on that thread when viewing on showthread? Something like this:
[Image: replywa.png]

I think this is a better idea somehow.
(2012-03-26, 01:54 AM)Paul H. Wrote: [ -> ]IIRC get_user() also uses the cache and doesn't always result in a query.

But if all last posters are different, it more likely will make many.
hmm.. this will easy when download this http://yaldaram.com/showthread.php?tid=398
Amazing!
Works great Big Grin
I wanted to edit this to link to the users profile, and I was also getting an error with the title="" attribute. Oh, I also went ahead and added get_user() in there. Here's the edited version.

http://wedesignthe.net/Forum-Announcements
I have a issue with inline moderation after using this plugin.

Now i can't rename thread title with one clic !

Can someone confirm ?
(2012-05-26, 03:05 PM)bestblackhatforum.com Wrote: [ -> ]On Display Avatars in threadlisting like Xenforo
How to show the OTHER user avatar when he reply on that thread when viewing on showthread? Something like this:
[Image: replywa.png]

I think this is a better idea somehow.

desactive Avatars in Thread Listing plugin

Find in forumdisplay.php:
$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:
$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
	");

Find in forumdisplay.php:
$thread['pages'] = 0;
		$thread['multipage'] = '';
		$threadpages = '';
		$morelink = '';
		$thread['posts'] = $thread['replies'] + 1;

add above:
//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

IN: ACP > Themes and Templates > Templates > Your Theme Templates > Forum Display Teamples > Forumdisplay_thread

Find:
<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>

Replace with:
<div>
            <table><tr><td id="tvatar">{$thread_avatar}<td id="tvatar2">{$thread_lpavatar}</td></td><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>

Then, finally, add this code 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;
}

Credits:
http://community.mybb.com/thread-114472.html
http://community.mybb.com/thread-79700.html
http://community.mybb.com/thread-114472-...#pid837345
http://mybbhacks.zingaburga.com/showthre...531&page=3

Results:
[Image: GI2f2.png]
[Image: CjQCP.png]

Tested in localhost
Hi martec, I have a problem with avatar user starter thread:

[Image: catturamck.png]
Pages: 1 2 3 4 5