thumbails in similar threads
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: thumbails in similar threads
Try this:

showthread.php

Find:

PHP Code:
if($mybb->settings['showsimilarthreads'] != 0)
{


Add this code after the code above:

PHP Code:
if($thread['fid'] == X){
	$addfields = ', atf.updatetime, atf.md5hash, atf.uploadtime, atf.aid, atf.attachname, atf.filename, atf.thumbs';
	$addfieldsjoin = ' LEFT JOIN '.TABLE_PREFIX.'xtattachments atf ON (atf.tid=t.tid)';
}

Replace the X with your images gallery forum id.

Find:

PHP Code:
1
2
3
4
5
6
7
8
9
$query = $db->query("
	SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance
	FROM ".TABLE_PREFIX."threads t
	LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
	WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'
	ORDER BY t.lastpost DESC
	LIMIT 0, {$mybb->settings['similarlimit']}
");


Replace it with:

PHP Code:
1
2
3
4
5
6
7
8
9
$query = $db->query("
	SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance{$addfields}
	FROM ".TABLE_PREFIX."threads t
	LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid){$addfieldsjoin}
	WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'
	ORDER BY t.lastpost DESC
	LIMIT 0, {$mybb->settings['similarlimit']}
");


Find:

PHP Code:
eval("\$similarthreadbits .= \"".$templates->get("showthread_similarthreads_bit")."\";");


Add this code before the code above:

PHP Code:
if($thread['fid'] == X){
	$xtimgsimilar_thread = '<img src="'.xthreads_get_xta_url($similar_thread).'/thumb160x120" alt="'.$similar_thread['subject'].'" />';
}

Replace X with your Images Gallery forum id, and 160x120 with the thumbnail size.

For displaying the thumbnail in your similar thread box, put this code in your showthread_similarthreads_bit template:

Code:
{$xtimgsimilar_thread}


05-26-2011 02:23 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
thumbails in similar threads - duhol - 05-25-2011, 11:34 PM
RE: thumbails in similar threads - RateU - 05-26-2011 02:23 AM
RE: thumbails in similar threads - duhol - 05-27-2011, 04:22 AM

 Standard Tools
Forum Jump: