Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-27-2007, 08:13 PM
footose footose is offline
 
Join Date: Mar 2006
Posts: 321
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default What array is the "Thread" information stored in?

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
Reply With Quote
  #2  
Old 12-27-2007, 09:25 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 12-27-2007, 10:09 PM
footose footose is offline
 
Join Date: Mar 2006
Posts: 321
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 [DATE]1198802924[/DATE] at [TIME]1198802924[/TIME] ---------------

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 [DATE]1198805317[/DATE] at [TIME]1198805317[/TIME] ---------------

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.

PHP Code:
<?php
// Attaches to the $hook_query_fields in showthread.php, line 965
$hook_query_fields .= ", " TABLE_PREFIX "tablename.field AS fieldname";

// Attaches to $hook_query_joins in showthread.php, line 977
$hook_query_joins .= "
LEFT JOIN " 
TABLE_PREFIX "tablename AS tablename ON(tablename.id = othertablename.id)";
?>
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
Reply With Quote
  #4  
Old 12-28-2007, 09:35 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No problem and :up: for putting up the solution.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:15 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08655 seconds
  • Memory Usage 2,190KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete