View Full Version : What array is the "Thread" information stored in?
footose
27 Dec 2007, 22:13
I'm making a plugin / addon for my board, and currently I am using a SELECT statement for every postbit. This is adding an overhead on the SQL server, because it essentially add's a query for every post.
I'm looking to collect all of the "posts" in a Thread before it is displayed so that I can run a single query against the database and dump it to an array, which will then be parsed by the postbit instead. I assume this is how VB is already doing this for the threads, so I want to access whatever is in the "thread" array.
I'm curious if anyone can tell me what this array is called, and it's identifiers.
Thank you.
Harry
Opserty
27 Dec 2007, 23:25
I'm not to sure what you are trying to do but if you look at Line 951 thats where the post query begins. (N.B. the hook 2 Lines above it).
If you create a plugin with that hook location and set the query variables appropriately you can fetch the addition info by joining the table to the existing query.
footose
28 Dec 2007, 00:09
Thanks. I will check into this and get back to you.
I have another table that I want the info from, so that it is displayed in the postbit, but I want to beable to do it with one query, instead of everytime there is a postbit displayed, like I currently have.
I was hoping that I could somehow "add on" to the $post, or $user or $thread array's with this info....
--------------- Added 1198802924 at 1198802924 ---------------
Sorry for another question but..
on line 965, there is the $hook_query_fields, this is where I would put the "select" statement that I want to add to this correct?
on line 977, this is where I would put the table I want to grab from?
and then where do I put my "where" statement "hook" ??
--------------- Added 1198805317 at 1198805317 ---------------
EDIT: I think I've done this correctly, as it is working now.. for other people that are interested
I put this into a plugin, using the showthread_query hook location.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Now I haven't added any extra queries to my page, thus keeping overhead down on SQL.
This particular example can be access by $post[] array, so $post[fieldname]
Thanks for the lead into the right direction Opserty
Opserty
28 Dec 2007, 11:35
No problem and :up: for putting up the solution. :)
vBulletin® v3.6.12, Copyright ©2000-2009, Jelsoft Enterprises Ltd.