XF 2.3 Connecting to XenForo's new login system (2.3.*)?

DarkUnderlord

Member
Licensed customer
We've got a forum we haven't upgraded to 2.3.* yet because of the changes to the XenForo login system.

Question: How do I use the new login system, or how can I get some basic info out of it?

We currently use this gaggle of code that sets up the XF $visitor object which lets us know if a user is logged in, who they are etc..:

Code:
// XenForo 2 Authentication
$startTime = microtime(true);
$fileDir = $webRoot . '/forums';

require($fileDir . '/src/XF.php');
XF::start($fileDir);
$app = XF::setupApp('XF\Pub\App');
$app->start();
// To handle bbcode parsing errors
XF::app()->templater()->addDefaultParam( 'xf', [
    'visitor' => \XF::visitor(),
    'ignoreUserRepo' => $app->repository('AddonFlare\GlobalIgnore:User'),
] );

// Connect to the DB

// Setup the XenForo visitor object.
$visitor = \XF::visitor();

I basically pull out some basic info (user_id, username) and dump the rest. This code handles our website front-end. So if you're logged into the forums, you're logged into the rest of the website.

How do I do that now with 2.3.*?
 
Back
Top Bottom