View Full Version : Help! Username/ID variable vs Current Profile Variable
kinny05
04-10-2007, 04:06 PM
Okay, I?ve been digging through vB forums for a while now using 3.64. I?ve figured out how to pull the username for the current user, but I need help figuring out how the pull the username or ID of the user?s profile I visit? as vbulletin->userinfo[username], only seems to pull for the id of the person logged in. I need this to run querys specific to each user?s profile when a visitor visit a that profile.
Query syntax like
?..
Select?.x x x
where profile_being_viewed = $ profile_being_viewed
anyone know the variable(s)/array(s) I?m looking for?:confused:
Zachery
04-10-2007, 04:36 PM
in the templates
User browsing the page is
$bbuserinfo $vbulletin->userinfo
User page is $userinfo
kinny05
04-10-2007, 04:49 PM
Thanks Zach, I'll give this a try tonite when I get home and post back!:D
I'm trying to pull these values into a php script so I can include them back into vB through a plugin.
Looks like the variables changed in 3.64
$bbuserinfo ------ >$vbulletin->userinfo['x']
Works in templates, but my biggest issue is pulling this variable over to php.
I ran a query of all my array data in userinfo and it never changes the user id or user name from the user logged in to the info of the user profile i'm visiting. I'm thinking this values is not pulled from array...?
Still kinda stuck. :confused:
Zachery
04-11-2007, 03:05 AM
$bbuserinfo << Templates only
$vbulletin->userinfo << anywhere not in the templates.
kinny05
04-11-2007, 06:28 PM
This is really wierd....:confused:
When I use $vbulletin->userinfo[username] directly in the template, it gives me what I want, which is the name of the user's profile (member page) i'm visiting. The problem is I can not get this value outside of the template because it always defaults back to the user logged in.
For instance, I'm logged in as Bobby, visiting Mike's page. $vbulletin->userinfo[username] should output Mike, but it pulls Bobby every time.
Tried to echo out through a pluggin hooked to the menber_start or global_start using...
ob_start();
echo $vbulletin->userinfo[username];
$givearray = ob_get_contents();
ob_end_clean();
Still alway defaults to the user logged in. Need to somehow caputer this value to get it into my PHP code.:cool:
Looks like the variable for the url location is consitent with what I need. I'll back door this unless some can provide a better solution.
<?php
$findmember = $vbulletin->session->vars[location]; // pull url location from vbulletin 3.6.5
$memberid = (str_replace("/forums/member.php?u=","",$findmember)); // fix string to filter down to the user id
echo $memberid; // verfy the proper id was pulled and held in memberid
?>
I strugged with doing it through vB for 3 days. PHP backdoor 5 minutes. Hope this helps someone else. Happy hacking:D
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.