Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Filtering Thread By Thread Author
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #11
RE: Filtering Thread By Thread Author
Did you try to use GROUP BY a.tid in the query?

08-15-2010 03:52 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #12
RE: Filtering Thread By Thread Author
Hi RateU, this is the code I tried:

Code:
1
2
3
4
5
6
7
8
9
		$query = $db->query('
			SELECT t.*, f.name, a.updatetime, a.md5hash, a.uploadtime, a.aid, a.attachname, a.filename
			FROM '.TABLE_PREFIX.'threads t
			LEFT JOIN '.TABLE_PREFIX.'xtattachments a ON (a.tid=t.tid)
			LEFT JOIN '.TABLE_PREFIX.'forums f ON (f.fid=t.fid)
			WHERE t.visible=1 AND t.uid='.intval($memprofile['uid']).' AND closed NOT LIKE "moved|%" AND t.fid IN ('.implode(',', $mnxtigp_fid_array).')'.$mnxtigp_unviewwhere.'
			'.$mnxtigp_lr.'
			GROUP BY a.tid
			LIMIT 0,'.intval($mybb->settings['mnxtigp_num']).'


But its giving me a syntax error. I tried putting the group thing in other places in the code but failed :/



[Image: leelink.gif]
MYBB1.6 & XThreads
08-15-2010 07:10 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #13
RE: Filtering Thread By Thread Author
Try to put it above the $mnxtigp_lr variable?

Code:
GROUP BY a.tid
'.$mnxtigp_lr.'


(This post was last modified: 08-15-2010 07:32 AM by RateU.)
08-15-2010 07:28 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #14
RE: Filtering Thread By Thread Author
Aha - that kind of worked - but see my profile page result:

http://easycaptures.com/fs/uploaded/426/5949684533.jpg

It seems that only the last post is showing in the preset format - and then with no picture...

BTW, I like fixing it like this - helps me to learn Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 08-15-2010 08:01 AM by leefish.)
08-15-2010 08:01 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #15
RE: Filtering Thread By Thread Author
It seems the URL lead to your download attachment (.rar file). Try to change the query like this:

PHP Code:
1
2
3
4
5
6
7
8
9
10
		$query = $db->query('
			SELECT t.*, f.name, a.updatetime, a.md5hash, a.uploadtime, a.aid, a.attachname, a.filename
			FROM '.TABLE_PREFIX.'threads t
			LEFT JOIN '.TABLE_PREFIX.'xtattachments a ON (a.tid=t.tid)
			LEFT JOIN '.TABLE_PREFIX.'forums f ON (f.fid=t.fid)
			WHERE t.visible=1 AND t.uid='.intval($memprofile['uid']).' AND t.closed NOT LIKE "moved|%" AND a.thumbs!="" AND t.fid IN ('.implode(',', $mnxtigp_fid_array).')'.$mnxtigp_unviewwhere.'
			GROUP BY a.tid
			'.$mnxtigp_lr.'
			LIMIT 0,'.intval($mybb->settings['mnxtigp_num']).'
		');


08-15-2010 08:30 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #16
RE: Filtering Thread By Thread Author
aha, that got it to work. Is that because the a.thumbs is now BEFORE the implode function?


[Image: leelink.gif]
MYBB1.6 & XThreads
08-15-2010 09:01 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #17
RE: Filtering Thread By Thread Author
Yes. The a.thumbs there will "order" the query to find the attachments in that thread which has thumbnail. Because file "doesn't have" a thumbnail, so, it will try to find another attachment in the thread which has thumbnail. And the query find an image which has a thumbnail, then pull it to profile. I think like that (sorry if I'm wrong Biggrin).

08-15-2010 09:11 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #18
RE: Filtering Thread By Thread Author
I see, and then the group by tid makes it so that IF there was a thread with two images it first goes finds the first images and then goes through again?

So if I was to select MORE images in the plug in settings than I have threads then it would show some threads twice?


[Image: leelink.gif]
MYBB1.6 & XThreads
08-15-2010 09:20 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #19
RE: Filtering Thread By Thread Author
(08-15-2010 09:20 AM)leefish Wrote:  I see, and then the group by tid makes it so that IF there was a thread with two images it first goes finds the first images and then goes through again?

It will go to another thread if the query already find an image there.

(08-15-2010 09:20 AM)leefish Wrote:  So if I was to select MORE images in the plug in settings than I have threads then it would show some threads twice?

Nope (I think). It will make the thread id "unique" in profile.

08-15-2010 09:35 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #20
RE: Filtering Thread By Thread Author
Hi RateU, here is what I did with the code you posted. Thank you very much again.

http://www.leefish.nl/mybb/member.php?ac...http://www.leefish.nl/mybb/member.php?action=pro


[Image: leelink.gif]
MYBB1.6 & XThreads
08-16-2010 07:47 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: