MyBB Hacks

Full Version: threadfield wont show
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
I put code to index.php. Now how to put threadfield into tamplates (forum is based on XThreads Youtube Gallery)?

PHP Code:
// Latest trailers


$xxx_trailers = 10;

	$altbg = alt_trow();
	
	$threadlist = '';
	$query = $db->query("
		SELECT t.*, u.username
		FROM ".TABLE_PREFIX."threads t

		LEFT JOIN ".TABLE_PREFIX."threadfields_data td ON  (td.tid=t.tid)



		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
		WHERE t.fid IN (".$xxx_trailers.") AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
		ORDER BY t.dateline DESC 
		LIMIT 0, 12"
	);

	while($thread = $db->fetch_array($query))
	{

		$thread['threadlink'] = get_thread_link($thread['tid']);

		$thread['forumlink'] = get_forum_link($thread['fid']);


if(my_strlen($thread['subject']) > 25)
		{
			$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
		}


		$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));

		$forumcache = $cache->read("forums");

		$thread['forumlink'] = "<a href=\"".get_forum_link($thread['fid'])."\">".$forumcache[$thread['fid']]['name']."</a>";

		eval("\$xxx_trailers_threadlist .= \"".$templates->get("xxx_index_trailers_latestthreads_thread")."\";");
		$altbg = alt_trow();
	}
	if($xxx_trailers_threadlist)
	{ 
		// Show the table only if there are threads
		eval("\$xxx_trailers_latestthreads = \"".$templates->get("xxx_index_trailers_latestthreads")."\";");

		eval("\$indexbox = \"".$templates->get("xxx_index_box")."\";");

	}


My forum: http://www.filmtoks.pl
Left, down column named "zwiastuny". I want thumbail for each movie. How to make it?

THX

Use xthreads_sanitize_disp function to parse threadfield data into what can be displayed.  Of course, you'll need to actually pull the threadfield data from the query as well.

If you're using XThreads attachments for thumbnails, you'll need to also pull attachment info, and then parse it.
If examples help, maybe take a look at these:
http://mybbhacks.zingaburga.com/showthread.php?tid=474
http://mybbhacks.zingaburga.com/showthread.php?tid=486
Processing thumbnails:
http://mybbhacks.zingaburga.com/showthread.php?tid=738
http://mybbhacks.zingaburga.com/showthread.php?tid=327

Hope that helps.
it isn't thumbail. it's xthreads youtube gallery. i only need field with "uIVyZkFbqJo" (youtube movie key).

how to take it from database? Erf
So, do you want to display YouTube Video thumbnail using the video id in your index page?
(04-14-2011 01:41 AM)RateU Wrote: [ -> ]So, do you want to display YouTube Video thumbnail using the video id in your index page?

yes Smile

i can subiect, tid, message, attach, and anything, but still can't put aby xthread threadfield.

i change code:

PHP Code:
// Latest trailers


$xxx_trailers = 10;


$pids = '';
$tids = '';
$comma = '';
$query = $db->query("
	SELECT p.pid, p.message, p.tid
	FROM ".TABLE_PREFIX."posts p
	LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
	WHERE t.fid IN (".$xxx_trailers.") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
	ORDER BY t.dateline DESC 
	LIMIT 0, 12"
);
while($getid = $db->fetch_array($query))
{
	$pids .= ",'{$getid['pid']}'";
	$tids .= ",'{$getid['tid']}'";
	$posts[$getid['tid']] = $getid;
}
$pids = "pid IN(0{$pids})";



	$altbg = alt_trow();
	$threadlist = '';
	$query = $db->query("
		SELECT t.*, u.username
		FROM ".TABLE_PREFIX."threads t
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
		LEFT JOIN ".TABLE_PREFIX."threadfields_data td ON (td.tid=t.tid)
		WHERE t.fid IN (".$xxx_trailers.") AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
		ORDER BY t.dateline DESC 
		LIMIT 0, 12"
	);

	while($thread = $db->fetch_array($query))
	{

	$thread['message'] = $posts[$thread['tid']]['message'];
	$thread['pid'] = $posts[$thread['tid']]['pid'];




		$thread['threadlink'] = get_thread_link($thread['tid']);

		$thread['forumlink'] = get_forum_link($thread['fid']);



if(my_strlen($thread['subject']) > 25)
		{
			$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
		}


		$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));

		$forumcache = $cache->read("forums");

		$thread['forumlink'] = "<a href=\"".get_forum_link($thread['fid'])."\">".$forumcache[$thread['fid']]['name']."</a>";


	$message = $parser->parse_message($thread['message'], $parser_options);

		eval("\$xxx_trailers_threadlist .= \"".$templates->get("xxx_index_trailers_latestthreads_thread")."\";");
		$altbg = alt_trow();
	}
	if($xxx_trailers_threadlist)
	{ 
		// Show the table only if there are threads
		eval("\$xxx_trailers_latestthreads = \"".$templates->get("xxx_index_trailers_latestthreads")."\";");

		eval("\$indexbox = \"".$templates->get("xxx_index_box")."\";");

	}

(04-14-2011 03:06 AM)duhol Wrote: [ -> ]but still can't put aby xthread threadfield.

Because you need to do this:
(04-13-2011 09:38 PM)ZiNgA BuRgA Wrote: [ -> ]Of course, you'll need to actually pull the threadfield data from the query as well.

I have a very simple Most Viewed Video plugin for XThreads YouTube Video Gallery. Maybe you can modify it as your needs.
I use ytvgalid key for the YouTube video id/URL, stored in threadfields_data table. You can see it in the query.
What can I say?
You are my personal Jezus Chrystus!
Plugin works perfect! Biggrin
Glad the plugin works.

Basically, if you want to pull out any data from XThreads custom thread fields, you need to do this:
(04-13-2011 09:38 PM)ZiNgA BuRgA Wrote: [ -> ]you'll need to actually pull the threadfield data from the query as well.

In the example plugin above, because I need to pull out the video id which is stored in ytvgalid custom thread fields, so I need to put it in the select field list in the query.

Now, you can create your own XThreads plugin Smile
Reference URL's