MyBB Hacks

Full Version: Wont show up with "Recent Threads On Index"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Wont show up with "Recent Threads On Index"
by dragonexpert  

but my globals are not showing up

Quote:
{$GLOBALS['threadfields']['key']}

help please
Custom plugins won't be pulling XThreads' field data, so it won't be there.
Quote:$query = $db->query("
            SELECT t.*, u.username AS userusername, u.usergroup, u.displaygroup, u.avatar as threadavatar, u.avatardimensions as threaddimensions, lp.usergroup AS lastusergroup, lp.avatar as lastavatar, lp.avatardimensions as lastdimensions, lp.displaygroup as lastdisplaygroup
            FROM ".TABLE_PREFIX."threads t
            LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
            LEFT JOIN ".TABLE_PREFIX."users lp ON (t.lastposteruid=lp.uid)
            WHERE 1=1 $where AND t.visible > {$approved} {$unsearchableforumssql} {$ignoreforums}
            ORDER BY t.lastpost DESC
            LIMIT $threadlimit
        ");

how can the custom plugin call the data? from which table?

cheers
If you're looking at how to modify it yourself, you can use this function as a guideline:

PHP Code:
// only 'username' and 'fid' keys are used from the $thread array
function xthreads_get_threadfields($tid, &$threadfields, $noextra=true, $thread=array()) {
	$tid = (int)$tid;
	if(!$tid) return;
	
	if(empty($thread))
		$thread = get_thread($tid);
	
	if($thread['fid'] == $GLOBALS['fid']) // use global cache if we're referring to current forum
		$threadfield_cache =& $GLOBALS['threadfield_cache'];
	if(!isset($threadfield_cache))
		$threadfield_cache = xthreads_gettfcache((int)$thread['fid']);
	
	if(!empty($threadfield_cache)) {
		global $db;
		$threadfields = $db->fetch_array($db->simple_select('threadfields_data', '`'.implode('`,`', array_keys($threadfield_cache)).'`', 'tid='.$tid));
		if(!isset($threadfields)) $threadfields = array();
		foreach($threadfield_cache as $k => &$v) {
			xthreads_get_xta_cache($v, $tid);
			xthreads_sanitize_disp($threadfields[$k], $v, $thread['username'], $noextra);
		}
	}
}

omg lol

how do i use it to pull info anywhere i need to?
Any help here please.

How can i pull the data onto the index and elsewhere, thanks
So how do i use that to return a value or an array of values?

Code:
&$threadfields


what does that mean, sorry I am a noob

if I call

xthreads_get_threadfields($tid, &$threadfields[$KEY]), how can I get it to return a value?

VALUE ? or ARRAY()?

Code:
 return $v;

how do i LEFT JOIN the Xthreads tables on to the normal mybb threadtable?

thanks
Reference URL's