Log in

View Full Version : Get user info from a userid


j_86
07-03-2007, 02:14 PM
Hi all,

How do I get user information from a user id in the PHP code?

RedTyger
07-03-2007, 05:46 PM
You can see what is available with print_r($vbulletin->userinfo) I think.

j_86
07-03-2007, 05:48 PM
Hi RedTyger,

Is that the userinfo of the person who is logged in, then?

Dismounted
07-04-2007, 05:07 AM
$vbulletin->userinfo['userid']

j_86
07-04-2007, 11:14 AM
Not working, inside class_dm_infraction.php;


////////////////////////////////////////////////////////////
// Modified so that the userid who the thread is posted by
// is actually the user who received the infraction.
// $dataman->setr('userid', $this->fetch_field('whoadded'));
$dataman->setr('userid', $userinfo['userid']);
$subject = $subject." given by ".$vbulletin->userinfo['userid'];
////////////////////////////////////////////////////////////


$vbulletin->userinfo['userid'] is empty.

The script already has: $this->fetch_field('whoadded') which contains the ID of the user (moderator) who gave the infraction). From this, I need user data. Can also assume the staff who is giving the infraction is also logged in, can't we?

If so - then why doesn#t $vbulletin->userinfo work?

Dismounted
07-04-2007, 12:45 PM
Try $this->registry->userinfo['userid'].

j_86
07-04-2007, 01:14 PM
Hi Dismounted,

Is there some sort of lookup function I am missing where I can pass a User ID and have it return user information? I'm surprised there isn't one.

Best,

Dismounted
07-05-2007, 04:56 AM
fetch_userinfo($userid);