The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
If someone could help me, I sure would appreciate it.
I added a column to table post: post.to_user (btw, values are stored correctly) which is a userid I added this plugin to hook: showthread_query Code:
$hook_query_fields = ",user.username AS to_username"; $hook_query_joins = "LEFT JOIN " . TABLE_PREFIX . "user AS u ON(u.userid = post.to_user)"; Code:
$hook_query_joins = "LEFT JOIN " . TABLE_PREFIX . "user AS u ON(u.userid = post.to_user)"; I previously ran the following query in phpMyAdmin, and got the correct results: Code:
SELECT user.username AS to_username FROM post LEFT JOIN user ON ( user.userid = post.to_user ) WHERE post.postid = 173 (I'm running 3.6.5) |
#2
|
||||
|
||||
![]()
I am guessing the query that comes out of your hook looks absolutely nothing like the query you ran in phpmyadmin.
for one thing, if you alias a table, you have to always refer to that table by the alias ,user.username AS to_username"; "LEFT JOIN " . TABLE_PREFIX . "user AS u ON(u.userid = post.to_user)"; By rights this query should complain "unknown column user.username in field list" I am guessing, however, that user is being called again somewhere else in the query so you have a user table and a user as u table and thereby pulling duplicate rows. It's just a guess though, what is really needed is the actual query your hook generates. |
#3
|
||||
|
||||
![]()
Database error in vBulletin 3.6.5:
Invalid SQL: Quote:
Date : Tuesday, June 12th 2007 @ 03:41:55 PM Script : http://www.northern-ny.net/kestrel/vbtest/showthread.php?t=6 Referrer : http://www.northern-ny.net/kestrel/vbtest/forumdisplay.php?f=2 IP Address : 74.78.5.54 Username : bobdell Classname : vb_database If I change the line: Quote:
Quote:
Quote:
So I guess my issue is how to include a WHERE/ON that will retrieve user.username AS to_username WHERE user.userid=post.to_user OK, forget it. I'm going to do this a different way. Probably execute a query in hook showthread_query, or add a new field (very inelegant) to table post. I've put in a request to add a hook after the WHERE clause to allow subqueries. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|