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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2014, 05:59 PM
Easelm Easelm is offline
 
Join Date: Mar 2009
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Source of vb:raw

Under which files are the raw scripts being called from?

For example {vb:raw post.username} <- because I would like to see it's query for pulling the username.

I am attempting to add a custom vb query and I do not want to put it directly on the template page.

Thank you in advance.
Reply With Quote
  #2  
Old 07-08-2014, 06:10 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

post.username basically means $post['username'];
If you're looking to modify the post array, you have to look into showthread.php line 1484 to 1651.

showthread_postbit_create is the hook in the loop which iterates through the posts.
Reply With Quote
Благодарность от:
tbworld
  #3  
Old 07-08-2014, 08:01 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That would likely be populated in global.php You'd have to be a lot more specific about what you want to change or how you want to change it, or even where it comes from, if you need help.

If you told us what you were trying to do, we might be able to help more.
Reply With Quote
Благодарность от:
tbworld
  #4  
Old 07-09-2014, 07:01 AM
Easelm Easelm is offline
 
Join Date: Mar 2009
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm trying to query a table in the same DB and post the info in the thread's postbit legacy
Reply With Quote
  #5  
Old 07-09-2014, 08:19 AM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you need to query the DB in the loop which iterates through the posts or do you need to query the DB before the loop? Else just use the hook like I said in my previous post.
Reply With Quote
  #6  
Old 07-09-2014, 09:59 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In file showthread.php, search for 'showthread_query' (it's there twice but you can look at either one). That hook location is called right before the query, and you can set variables $hook_query_fields and $hook_query_joins to add fields (and join tables if necessary) to the post query.

For example, if there was an added table called more_userinfo in the database and I wanted to use all fields from it in postbit, I might use this plugin code:
Code:
$hook_query_fields .= ', more_userinfo.* ';
$hook_query_joins .= ' LEFT JOIN more_userinfo ON (more_userinfo.userid = user.userid) ';
then the fields from more_userinfo that correspond to the post author should be available in the postbit as {vb:raw post.fieldname}.
Reply With Quote
2 благодарности(ей) от:
Lynne, tbworld
  #7  
Old 07-09-2014, 02:58 PM
Easelm Easelm is offline
 
Join Date: Mar 2009
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
In file showthread.php, search for 'showthread_query' (it's there twice but you can look at either one). That hook location is called right before the query, and you can set variables $hook_query_fields and $hook_query_joins to add fields (and join tables if necessary) to the post query.

For example, if there was an added table called more_userinfo in the database and I wanted to use all fields from it in postbit, I might use this plugin code:
Code:
$hook_query_fields .= ', more_userinfo.* ';
$hook_query_joins .= ' LEFT JOIN more_userinfo ON (more_userinfo.userid = user.userid) ';
then the fields from more_userinfo that correspond to the post author should be available in the postbit as {vb:raw post.fieldname}.

That's exactly what I was looking for, thank you

--------------- Added [DATE]1404923672[/DATE] at [TIME]1404923672[/TIME] ---------------

@kh99, I did exactly what you suggested and it worked like a charm. Thank you again for your reply, I can now continue my projects
Reply With Quote
Благодарность от:
kh99
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 08:56 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05793 seconds
  • Memory Usage 2,232KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (5)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete