The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I have hardly worked with queries and I am trying to adjust a mod to show the first attachment of the first post of a specific forum.
Code:
$query_attachments = $vbulletin->db->query_read(" SELECT thread.threadid, thread.firstpostid, thread.forumid, attachment.extension, attachment.postid, attachment.attachmentid FROM " . TABLE_PREFIX . "attachment INNER JOIN " . TABLE_PREFIX . "thread ON thread.firstpostid=attachment.postid WHERE (attachment.extension = 'jpg' OR attachment.extension = 'gif' OR attachment.extension = 'png') AND thread.forumid=6 AND dateline < " . TIME() ." ORDER BY dateline DESC LIMIT 5"); -thread.threadid can be used to link to a specific post using a hyperlink. -thread.firstpostid has to match attachment.postid. Hopefully, this will return the threads with attachments. -using the where clause, i want to restrict the returns to forum ID 6 only. I have only tried simple queries in the past (first use of inner join) and I am wondering if the general idea for this query is sound. Any help or hints is appreciated. |
#2
|
|||
|
|||
![]()
nobody?
|
#3
|
|||
|
|||
![]()
Good Luck Bernd , I am also trying to show first attached image as my post icon and getting no replies or ideas even though this would truly expand VB to multiple new markets if it can do this.
Markets that could benefit from this: Adult Sites Fan Based Sites Merchants selling Products Movie Web Sites Photo or Image Sites |
#4
|
||||
|
||||
![]()
Don't you want to put something in there to grab it just for a specific threadid? AT what point are you running this query? And what is the expected result here?
|
#5
|
|||
|
|||
![]() Quote:
Basically, what I am trying to create is a cmps module that displays the first image of every thread in a specific forum (e.g. latest 5 results) . The query will be running on every frontpage request, as it will be displaying the latest resources available in a specific forum (basically threads with binaries and image attachments). Once fully working, I will post the modifications in the mod thread so that everybody will benefit from it. |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|