![]() |
memberinfo template - what variable do I 'pass' to a PHP script for a member's userID
I've creating small PHP script that I'll be using to output info on the Memberinfo template by way of a pluugin.
What variable do I use in the PHP script for the userID of the profile I'm looking at at the time? Assuming my userID is 1 and I'm looking at the profile of the person whose userID is 5 - I want userID=5 to be passed through to the PHPscript or 10 if their userID happens to be 10. |
try $vbulletin->GPC['userid']
not tested ^^ |
Thanks for the speedy reply (it's REALLY appreciated!) and your suggestion works. :) :)
|
Great to hear :)
|
I created a PHP script yesterday that displays fine in a vB template via a plugin. I've created another PHP script today but when I view it in a vB template it just outputs the content of the PHP script (the actual PHP script is what you see), it doesn't actually execute the PHP script and output the result of that.
I've double checked the script and it appears fine... something, I can't figure out what, is stopping vB from 'executing' the PHP script. |
Come again?
Whats he code of the script and the template? |
Typical... I make a forum posting and then figure out what's wrong... vB wasn't happy because there wasn't a space between the = and the 'searchvalue'.
I've made some progress but I've still having a problem... Here's my PHP code: Code:
<?php (rp_reviews.userid = {$vbulletin->GPC['userid']}) to (rp_reviews.userid = '1959') then the script works fine / as expected so I suspect I might be using the wrong variable in my query. |
Is this a vbulletin script?
|
No it's something I've written myself to utilise data from a Reviewpost table and show it on a user's profile page. I'm new to mySQL, PHP and vB plugins so it's pretty much done by looking at other similar code and modifying / altering to suit what I want to do.
|
k first of all if your using plugins hooks are used to display the code on pages e.g forumhome_compete will execute at the bottom of the index.php file.
If your adding code, you will be using member_*** Next, you dont need to connect to the database, it is done automatically. Also you dont need the opening php tag or the closing one. Finally I taken a bit of your code and changed it around to be more vbulletin compatible PHP Code:
Hope that helps. |
Thanks for your help so far.
The database that I'm querying isn't the vB database which is why I used 'connect to database' - sorry I didn't make that clear. I've just changed the hook location from member_start to member_complete and I'm happy to say it's working :) I originally chose member_start because I thought that would get processed / executed before member_complete - thinking that member_complete might be used for 'end of page' things - may be a stupid assumption but I often do things through trial and error... often the best way to get your head around things when you don't really know what you're doing LOL. I tried doing some reading up yesterday on the different hook locations but the vB manual wasn't very informative. |
Good to hear :) Remember that the files only print out the template and dont echo html
|
All times are GMT. The time now is 05:03 PM. |
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:
|