The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How do I access a variable from a custom include?
Ok, I posted this question on vb.com, and after some research figured that this is the board with the smarter people So I figured it would be answered better here.
Here it is: I am including a file into the member profile using the plugin system (ob_start()... etc). The plugin works fine, except for one thing: I can't figure out how to get the username variable of the profile being viewed. For example, if you look at this page: http://www.scubaaddict.com/scuba-forums/member.php?u=66 I have written a customization showing the articles written by that user. Is there any way to get access to the $vbulletin->userinfo['username'] and have the value be that user (mcm007)? Whenever I try to access that variable from my include, it shows my username (Addict) - even though the exact same code in the template shows produces 'mcm007'. Currently, I am snagging the uid from the Querystring and getting the username by using that uid in a query - problem is that if you access the same profile in a different manner, that querystring parameter is not available. Does anyone know how I can use this variable like I want to? or can point me to a place that has a more detailed explanation of how to use the variables in the templates? TIA - Addict |
#2
|
||||
|
||||
$userinfo[username]
It works in the template, not sure if it works out of the template though, worth a try. |
#3
|
|||
|
|||
Dismounted - No, that doesn't work ($userinfo[username] contains my username when viewing someone else's profile) - but thanks for replying
Maybe I need to figure out a different way to insert my table... ---------------UPDATE---------------- Ok, there has to be a way. If you wanted to modify this page: http://www.scubaaddict.com/scuba-for...stposter&t=162 how would you get to that user's id, or username? It isn't in a variable anywhere. I did a print_r($vbulletin) and there is nothing with that users id or username on the above page, so how does it display the username on that page? ---------------UPDATE---------------- The only way I see to get the userid on the member profile is to drop in a conditional in the include that queries based on the querystring parameter provided. PHP Code:
Seems expensive, so if anyone knows of a better way, please let me know. Addict |
#4
|
||||
|
||||
No it doesn't, $bbuserinfo contains your own, $userinfo contains theirs.
|
#5
|
|||
|
|||
Dismounted,
Are you talking in the template or an included file? In the template it shows fine, but if you put that variable in an included file, the value I am getting for both variables is my username. |
#6
|
||||
|
||||
Quote:
|
#7
|
|||
|
|||
Quote:
Not sure what your script looks like but $vbulletin->userinfo['username'] should work. |
#8
|
||||
|
||||
He wants the loaded member profile's info, not his own...
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|