vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Source of vb:raw (https://vborg.vbsupport.ru/showthread.php?t=312830)

Easelm 07-08-2014 05:59 PM

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.

Dave 07-08-2014 06:10 PM

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.

Zachery 07-08-2014 08:01 PM

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.

Easelm 07-09-2014 07:01 AM

I'm trying to query a table in the same DB and post the info in the thread's postbit legacy

Dave 07-09-2014 08:19 AM

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.

kh99 07-09-2014 09:59 AM

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}.

Easelm 07-09-2014 02:58 PM

Quote:

Originally Posted by kh99 (Post 2506072)
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 ;)


All times are GMT. The time now is 09:20 PM.

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.01080 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete