XF 2.1 Wordpress user needs to displays as logged on forums website.

vikramjeet

New member
I have installed forum https://forums.thebaronsclub.com/ and wordpress website is https://thebaronsclub.com/
Want to when wordpress user login that does not require to login again for fourm website.

I have already bought Xpress and Xlink.
Xpress remote login options does works for Remote webiste to Fourm website login I think they work from Fourm website to remote website login.

For now I have write this code to complete my requirement. But customer still not shown as logged in on Fourm website.

$finder = XF::finder('XF:User');
$user = $finder->where('username', $userName)->fetchOne();

$clientIpAddress = XF::app()->request()->getIp();

XF::session()->changeUser($user);
XF::setVisitor($user);

XF::repository('XF:SessionActivity')->clearUserActivity(0, $clientIpAddress);

XF::repository('XF:Ip')->logIp(
$user->user_id, $clientIpAddress,
'user', $user->user_id, 'login'
);

After applied this code from wordpress try to print session and visitor it will work and show me which user is logged in session. But it does not seems login when I visit fourm website. Please suggest me.
 
Top Bottom