MyBB Community Forums

Full Version: Posticons in threaded mode - how?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.

How to get posticon showing in front of the post subject in threaded view box?

I've been trying to add {$post['icon']} in front of {$post['subject']} in showthread_threaded_bit template but it didn't change anything. What i'm doing wrong?

Thanks in advance.
Bump.
Open showthread.php

Find
		// Build the threaded post display tree.
		$query = $db->query("
            SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline
            FROM ".TABLE_PREFIX."posts p
            WHERE p.tid='$tid' 
            $visible
            ORDER BY p.dateline
        ");

Change into
		// Build the threaded post display tree.
		$query = $db->query("
            SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline, p.icon
            FROM ".TABLE_PREFIX."posts p
            WHERE p.tid='$tid' 
            $visible
            ORDER BY p.dateline
        ");

Find
function buildtree($replyto="0", $indent="0")
{
	global $tree, $mybb, $theme, $mybb, $pid, $tid, $templates, $parser;

Change into
function buildtree($replyto="0", $indent="0")
{
	global $tree, $mybb, $theme, $mybb, $pid, $tid, $templates, $parser, $cache;

Find
			if(!$post['subject'])
			{
				$post['subject'] = "[".$lang->no_subject."]";
			}

Add Below
			$icon_cache = $cache->read("posticons");
			if($post['icon'] > 0 && $icon_cache[$post['icon']])
			{
				$icon = $icon_cache[$post['icon']];
				$post['icon'] = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />&nbsp;";
			}
			else
			{
				$post['icon'] = "";
			}

After changing everything you should be able to use {$post['icon']} in your showthread_threaded_bit template.

Screen:
[Image: threaded_bit_posticon.jpg]
Thank you very much, LeX!

And I thought it'd be simpleSmile