![]() |
How to get userid of members by php?
hello,
How to get userid of members by php? I use vbulletin 5. Thanks! |
Can you elaborate more on what you are trying to do?
|
I want to get userid of members when logging in forum.
get userid vbulletin 4: $user = $vbulletin->userinfo; echo $user['usertid']; |
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; |
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 |
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; |
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 |
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?
|
I have edit $vbpath = '/var/www/forum.whitehat.vn/.'; and it works.
Thanks! |
All times are GMT. The time now is 01:57 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|