The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to get userid of members by php?
hello,
How to get userid of members by php? I use vbulletin 5. Thanks! |
#2
|
||||
|
||||
Can you elaborate more on what you are trying to do?
|
#3
|
|||
|
|||
I want to get userid of members when logging in forum.
get userid vbulletin 4: $user = $vbulletin->userinfo; echo $user['usertid']; |
#4
|
||||
|
||||
The vbulletin object is still available in vb5. The code you show should work.
For getting userid in scripts, this works for me. $uid=$vbulletin->userinfo['userid']; echo $uid; |
Благодарность от: | ||
MarkFL |
#5
|
|||
|
|||
I added the code into file account.php
$uid=$vbulletin->userinfo['userid']; echo $uid; But error: Notice: Undefined variable: vbulletin in /var/www/forum.whitehat.vn/Soccer/account.php on line 128 Notice: Trying to get property of non-object in /var/www/forum.whitehat.vn/Soccer/account.php on line 128 |
#6
|
||||
|
||||
Account.php is not a core file. You'll need to start up the vbulletin backend to get a result. This example assumes the account.php file is inside your forum root directory. This is a bare bones example.
<?php require_once('./includes/vb5/autoloader.php'); $vbpath = '.'; vB5_Autoloader::register($vbpath); vB5_Frontend_Application::init('config.php'); $uid=$vbulletin->userinfo['userid']; echo $uid; |
#7
|
|||
|
|||
I edit:
require_once('/var/www/forum.whitehat.vn/includes/vb5/autoloader.php'); $vbpath = '.'; vB5_Autoloader::register($vbpath); vB5_Frontend_Application::init('config.php'); $uid=$vbulletin->userinfo['userid']; echo $uid; But error: Class 'vB5_Frontend_Application' not found |
#8
|
||||
|
||||
Try using your full system path for $vbpath. It's not finding the Class because it's not looking in the right location. Is you account.php file in the /var/www/forum.whitehat.vn directory?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|