Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Is this possible? Displaying threads on index with x criteria
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #7
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?

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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).'
	');



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 05-11-2012 05:18 AM by leefish.)
05-11-2012 05:07 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: Is this possible? Displaying threads on index with x criteria - leefish - 05-11-2012 05:07 AM

 Standard Tools
Forum Jump: