• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to detect a user outside the forum

#1
I am still using VB 3.7 although am preparing my new XF.

When using VB I can detect a user logged in the forum but participating in other sections of my web. For exemple a user can post a comment on an article without logging in again.

I don't know if I am explaining myself clearly.

I can do that with these lines of code:

----------------------
include('./global.php');
include('./includes/functions_user.php');
$_SESSION["forero"] = $vbulletin->userinfo['username'];
----------------------

Is there a way to do the same in XF?

Thank you!
 
Last edited:
#2
I am still using VB 3.7 although am preparing my new XF.

When using VB I can detect a user logged in the forum but participating in other sections of my web. For exemple a user can post a comment on an article without logging in again.

I don't know if I am explaining myself clearly.

I can do that with these lines of code:

----------------------
include('./global.php');
include('./includes/functions_user.php');
$_SESSION["forero"] = $vbulletin->userinfo['username'];
----------------------

Is there a way to do the same in XF?

Thank you!
Can probably do the same thing with this
http://xenforo.com/community/resources/xenforo-sdk.2790/
 
#5
I am trying to print my forum nickname using your application but I must be doing something wrong:

Code:
<?php
require_once('XenForoSDK.php');
$sdk = new XenForoSDK;
$loggedIn = $sdk->isLoggedIn();
if($loggedIn) {
echo 'Logged In';
} else {
echo 'Guest';
}
// Get current user
$user = $sdk->getUser();
echo $user;
?>
Thank you for your help @Vincent Gabriel