The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Getting &u=* to work
If you notice private.php has it so adding &u=90 will make member ID 90's username show up in the recipient field.
My question, how would I go about doing this in my own custom PHP file and template? What snippet controls this- if any. |
#2
|
||||
|
||||
I think your looking for something like this:
PHP Code:
In the case of your example above it might look something more like PHP Code:
(untested) However, using superglobals like this is a really bad idea, because it would allow someone to inject code into the php file by the address bar. At the very least you should attempt to sanitize the input before using it. (with regex maybe?) There may be a safer or better way of doing this, but I'll leave that reply to someone more experienced than myself at PHP. |
#3
|
|||
|
|||
Quote:
PHP Code:
If you're wondering how private.php does it: around line 1350 or so in private.php is this code PHP Code:
So a little farther down in private.php is PHP Code:
|
#4
|
|||
|
|||
That solved the first problem^.
I know have the u=9 displaying 9 in the field. But how could I make it so it will show userid 9's username in the field? I looked a little farther down in private.php and used that code with my own variables but it didn't do anything. I've also cleaned u and made sure it was greater than 0. |
#5
|
|||
|
|||
You'd have to read the user name from the database. If you have $userid and the user name is all you want, then something like:
PHP Code:
private.php does a more complex query (around line 1481) to get more info about (possibly multiple) users in one query. (BTW, I don't know what the "query_slave" versions of the calls do so I don't know why query_first_slave is used in private.php). |
#6
|
|||
|
|||
Thank you so much for your help^.
I have it working perfectly now. |
#7
|
|||
|
|||
Why dont you use fetch_userinfo function?
|
#8
|
|||
|
|||
Would that be better?
And the reason being I'm not aware of it. |
#9
|
|||
|
|||
I didn't know about that either. Cool. I think it would be better because it's always better to keep the details out of your code as much as possible (such as how the database is structured), and also it looks that function caches user info so that if some other code has already looked up that user, you won't have to do another db query.
|
#10
|
|||
|
|||
Well hopefully someone can enlighten me on this. I'm always looking to make the codes as best as possible.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|