PDA

View Full Version : Making Private Messages Show on Forum Home...


Chief Corn
12-06-2002, 07:25 PM
here's my forum...
Forum2kTree (http://forum.2ktree.com)

i'm just learning how to hack up vbulletin. as you can see in the private messages inbox category is some blank cells. i'm trying to add the date sent and who in the the "last post" cell...like how it is with the forums.

i tried $privatemessage[datesent], and $privatemessage[displayusername] which i took from the official private message page code...but no luck.

could somebody help me?

-Chief Corn

*update* i just realized that you would have to be register to see the private message category...but to give you a visual: it would look like the next main forum category but it says Private Messages and the "sub-forum" is called Inbox. the cells next to it are blank...

Xenon
12-06-2002, 09:47 PM
setting up a test account for us would help more i think ;)

also du you just copy the vars into forumhome template, or have you modified index.php (you have to or it cannot work ;))

Chief Corn
12-06-2002, 09:53 PM
here's a test account...

username: vbhelp
password: vbhelp

...no i didn't edit the index.php. don't know what to put.

Xenon
12-06-2002, 10:03 PM
ahh, that helps :)

well you have to edit index.php

find this code:
eval("\$pminfo = \"".gettemplate('forumhome_pmloggedin')."\";");

below add:
$privatemessage=$DB_site->query_first("SELECT privatemessage.*, user.username FROM privatemessage LEFT JOIN user ON (user.userid=privatemessage.fromuserid) WHERE userid=$bbuserinfo[userid] LIMIT 1 ORDER BY privatemessageid DESC");

now you can use the vars...

Chief Corn
12-06-2002, 10:22 PM
entered it exactly as you typed it...but i get a error page that says:

----------------------------------------
Invalid SQL: SELECT privatemessage.*, user.username FROM privatemessage LEFT JOIN user ON (user.userid=privatemessage.fromuserid) WHERE userid=1 LIMIT 1 ORDER BY privatemessageid DESC
mysql error: You have an error in your SQL syntax near 'ORDER BY privatemessageid DESC' at line 1

mysql error number: 1064
-----------------------------------------

tried it twice...once below that line, and once above it. i'm pretty sure this can be done...and you have it....but possibly a typo somewhere?

-Chief Corn

Erwin
12-06-2002, 10:42 PM
Try changing the end of that PHP code from


ORDER BY privatemessageid DESC");


to:


ORDER BY privatemessageid DESC LIMIT 1");

Chief Corn
12-06-2002, 11:31 PM
this is the new error... :confused:

---------------------------------
Invalid SQL: SELECT privatemessage.*, user.username FROM privatemessage LEFT JOIN user ON (user.userid=privatemessage.fromuserid) WHERE userid=1 ORDER BY privatemessageid DESC LIMIT 1
mysql error: Column: 'userid' in where clause is ambiguous

mysql error number: 1052
----------------------------------

-Chief Corn

Erwin
12-07-2002, 06:12 AM
Try this:


$privatemessage=$DB_site->query_first("SELECT privatemessage.*, user.username FROM privatemessage LEFT JOIN user ON (user.userid=privatemessage.fromuserid) WHERE user.userid=$bbuserinfo[userid] LIMIT 1 ORDER BY privatemessageid DESC LIMIT 1");

Xenon
12-07-2002, 11:27 AM
damn, what hav i done ;)

hmm erwin i think asuming userid to PM-table would be better:

$privatemessage=$DB_site->query_first("SELECT privatemessage.*, user.username FROM privatemessage LEFT JOIN user ON (user.userid=privatemessage.fromuserid) WHERE privatemessage.userid=$bbuserinfo[userid] ORDER BY privatemessageid DESC LIMIT 1");

Chief Corn
12-07-2002, 01:34 PM
i tried both of those lines and i get:

-----------------------------
Invalid SQL: SELECT privatemessage.*, user.username FROM privatemessage LEFT JOIN user ON (user.userid=privatemessage.fromuserid) WHERE user.userid=1 LIMIT 1 ORDER BY privatemessageid DESC LIMIT 1
mysql error: You have an error in your SQL syntax near 'ORDER BY privatemessageid DESC LIMIT 1' at line 1

mysql error number: 1064
------------------------------

http://forum.2ktree.com doesn't work anymore...but http://www.2ktree.com/forum does which is strange.

-Chief Corn

Xenon
12-07-2002, 02:59 PM
retry it, be sure you have cut out the first limit clause