![]() |
Hook location help
I'm using a feedback system (itrader) mod which gives all users on my site a feedback score based on successful item purchases, and I would like to include this score in the postbit. However, a certain few lines of code need to be executed in order to fetch the value of the feedback variable from the database.
Which hook location would I use to insert my code, given a separate feedback score needs to be retrieved for each postbit? The variable which my code should populate is included in my postbit_legacy template. |
I'd figure out the names of the columns you need and in which table they are in and see if you can use a plugin to do a join into and existing query for the post information. But, as I mentioned, you need the name of the column, the table, and the column to do userid join on.
|
Thanks for the reply!
Here's the query that I'd be running: Code:
$itraders = $vbulletin->db->query_read("SELECT COUNT(" . ($vbulletin->options['itrader_ratestyle'] ? 'DISTINCT(userid)' : 'userid') . ") AS usercount, COUNT(*) AS usercountall, rating |
That would add one query per post. It's better to add a join to an existing query is what I'm saying.
|
Definitely- fifteen extra queries per page of a thread could be pretty hard on the server. Let me know if you can help me out with finding the one query to add my code to, and if you need any additional info. Thanks in advance!
|
Look in showthread.php - look where it generates a query for users. ;)
|
Looks like that would be around
PHP Code:
Update: After placing that query after showthread_query, I get a DB error: Code:
Database error in vBulletin 3.7.4: PHP Code:
|
Look at the query right under that hook!!! You can use $hook_query_joins...
|
I don't think $userinfo is going to work on the showthread page. The variable you want to use there is $post. So, try changing that in your query and see if it works.
But, as Hanson pointed out, you can simply join into the existing $post query to grab your information there with a join to your itrader table. |
Your mentioning $post got me to try using those in my postbit, and it turns out both $post[itrader_total] and pcnt are defined. So problem solved! Thanks for your help.
|
All times are GMT. The time now is 12:59 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|