RE: Is this possible? Displaying threads on index with x criteria
whoa- that was fast. You know what I am going to ask, right? How to make this for multiple forum ids.....?
I looked in the code, I see this line:
Code:
WHERE t.fid='.intval($forumid).' AND t.visible=1 AND t.closed NOT LIKE "moved|%" AND p.visible=1 AND t.replies>0 AND p.dateline>'.$cutdate.' AND p.pid!=t.firstpost
If I was to make the fid variable a comma separated list and changed the line in the query as below, would that also work?
if(is_array(explode(',', $forumid])))
{
foreach(explode(',', $forumid']) as $forum_fid)
{
$forum_fid_array[] = intval($forum_fid);
}
}
if(!empty($threadfieldscache)){
$xtfields = '';
foreach($threadfieldscache as &$tf){
$xtfields .= ',tf.'.$tf['field'].' AS xthreads_'.$tf['field'];
}
}
$query = $db->query('SELECT COUNT(p.pid) as posts,t.tid,t.fid,t.subject,t.username as threadusername,u.username,u.usergroup,u.displaygroup'.$xtfields.'
FROM '.TABLE_PREFIX.'threads t
LEFT JOIN '.TABLE_PREFIX.'threadfields_data tf ON(tf.tid=t.tid)
LEFT JOIN '.TABLE_PREFIX.'posts p ON(p.tid=t.tid)
LEFT JOIN '.TABLE_PREFIX.'users u ON(u.uid=t.uid)
WHERE t.fid IN ('".implode("','", $forum_fid_array)."') AND t.visible=1 AND t.closed NOT LIKE "moved|%" AND p.visible=1 AND t.replies>0 AND p.dateline>'.$cutdate.' AND p.pid!=t.firstpost
GROUP BY p.tid
ORDER BY posts desc
LIMIT 0,'.intval($tlimit).'
');