PDA

View Full Version : Retrieving username / userid for widgit


zushiba
02-07-2011, 03:20 PM
Hey all. I am trying to write what should be an easy widgit using php but I'm struggling with finding out how to retrieve the username or userID.

I am trying to list forms the user has entered but to get to that point I need the users ID.

After searching and searching I find a lot of stuff for VB 3 that either no longer works or never worked. The last, simple code I found was
ob_start();
$myusername = $vbulletin->userinfo['username'];
echo $myusername;
$output .= ob_get_contents();
ob_end_clean();


But that outputs nothing. I tried looking through the VB4 articles but those seemed focused on creating templates and stuff, all of which is too big for what I'm trying to do and they STILL seem to leave out simple stuff like retrieving user info via php.

EDIT: Solved using the following code

ob_start();
$myusername = vB::$vbulletin->userinfo['username'];
echo $myusername;
$output .= ob_get_contents();
ob_end_clean();

required vB::

Lynne
02-07-2011, 04:21 PM
I actually cover this here - Creating an HTML or PHP Widget (http://www.vbulletin.com/forum/showthread.php/371690-Creating-an-HTML-or-PHP-Widget)

zushiba
02-07-2011, 05:27 PM
Thank you this is an excellent resource. I didn't even think to look there.