View Full Version : Source of vb:raw
Easelm
07-08-2014, 05:59 PM
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.
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
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.
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:
$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
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:
$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 1404923672 at 1404923672 ---------------
@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 ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.