View Full Version : Using userid on a Different Page
sharpkiller
01-21-2011, 12:20 PM
Hello again,
I've completely written my hack in PHP, and now I'm actually looking to integrate it into vBulletin 3. So far I have created a vBulletin page which executes my php code. However, in order for this to work as intended, I'll to add a link to this page somewhere on thread display. I'll also need to pass the userid of the original poster, the threadid, and the userid of the user who is using this hack. However, I'm not certain how I might accomplish this.
Thanks for any help you can provide.
When you say thread display do you mean the output of showthread.php? If so, you could edit the template SHOWTHREAD and put in your link, and use $threadinfo[postuserid], $threadinfo[threadid], and $bbuserinfo[userid] for the data you need to pass.
sharpkiller
01-21-2011, 01:55 PM
Oops, yes - sorry. I got it mixed up with forum display. Anyway, using those variables, how would I pass the correct data contained in $threadinfo[postuserid] and $threadinfo[threadid] to my PHP file? Thanks for your help so far. :D
Well, I guess the same way you'd do it for any html, like put the info in the url, or submit a form. For example, you could put this somewhere in the template:
<a href="myscript.php?threaduser=$threadinfo[postuserid]&threadid=$threadinfo[threadid]&userid=$bbuserinfo[userid]">Link to my script</a>
Then in your script it will be in $_REQUEST[]. If you included global.php in your script, you could use $vbulletin->input->clean_gpc() to make sure the values are integers and put them in $vbulletin->GPC[]. (There's an example of this in almost every "top level" vbulletin script).
Hopefully I'm understanding what you want to do.
ETA: just realized, if you did include global.php in your custom script then you don't need to pass the "current" user's id, you can get it in your script by using $vbulletin->userinfo['userid'];
sharpkiller
01-21-2011, 02:51 PM
That's exactly what I needed. I just tested it and it works perfectly. Thanks for your help!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.