PDA

View Full Version : custom field on showthread template via threadinfo


tpearl5
05-14-2013, 01:11 PM
I'm trying to use a custom field on showthread via threadinfo. I know that the field has to be included in the threadinfo query somehow, but I don't know how to do it. It needs to be threadinfo because I would like to use the custom field of the thread poster. The result should be $threadinfo['fieldX']

Ideas?

kh99
05-14-2013, 01:54 PM
Try creating a new plugin using hook fetch_threadinfo_query and this code:
if (THIS_SCRIPT == 'showthread')
{
$hook_query_fields .= ", userfield.fieldX ";
$hook_query_joins .= " LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(thread.postuserid = userfield.userid) ";
}


and of course you'll want to change the X to the actual field id.

tpearl5
05-14-2013, 02:09 PM
thanks! highly appreciated! I'll give it a try.

kh99
05-14-2013, 04:01 PM
Oops, there was an error in what I posted - it should have been userfield.fieldX instead of poster.fieldX.