I need from a separate server a way to check if user is logged in on the xenforo server.
I implemented a remote login integration with my CMS and Xenforo API. When user press a link his account get created and he do automatico login on xenforo.
The only one issue is that if user it do one time during the current session and after it come back to main site to return later on forum the script is not able to underatnd if is already logged in on forum or not.
What i need is a way from the CMS server ( remotly so ) to check xenforo server and get if user is logged in or not .
At moment the script is not able to know if user is logged in or not on xenforo server and every time so the user click that link he try to LOGIN him again with a consequent error on xenforo that inform the user he did already the login. It is not nice to see and make confusion. I want tso that my script before doing login he check if the current user is logged in on forum server.
I found some codes around but that codes are working if CMS and Xenforo are hosted on the same server on different folders. If i try to call this script from remote because i can do it only with a CURL it give me back always user is GUEST. That why it is not the solution
The issue with my solution is that Xenforo and my CMS are hosted on separate servers. What can i do to solve the issue here ?
Thanks
I implemented a remote login integration with my CMS and Xenforo API. When user press a link his account get created and he do automatico login on xenforo.
The only one issue is that if user it do one time during the current session and after it come back to main site to return later on forum the script is not able to underatnd if is already logged in on forum or not.
What i need is a way from the CMS server ( remotly so ) to check xenforo server and get if user is logged in or not .
At moment the script is not able to know if user is logged in or not on xenforo server and every time so the user click that link he try to LOGIN him again with a consequent error on xenforo that inform the user he did already the login. It is not nice to see and make confusion. I want tso that my script before doing login he check if the current user is logged in on forum server.
I found some codes around but that codes are working if CMS and Xenforo are hosted on the same server on different folders. If i try to call this script from remote because i can do it only with a CURL it give me back always user is GUEST. That why it is not the solution
Code:
<?php
require('src/XF.php');
\XF::start('/hc');
$app = \XF::setupApp('XF\Pub\App');
$s = $app->session();
$uid = $s->get('userId');
if ($uid){
$finder = \XF::finder('XF:User');
$user = $finder->where('user_id', $uid)->fetchOne();
print_r($user->username);
}else{
echo 'guest';
}
?>
The issue with my solution is that Xenforo and my CMS are hosted on separate servers. What can i do to solve the issue here ?
Thanks
Last edited: