How to Bridge PHP and XenForo 2

Beginners How to Bridge PHP and XenForo 2

LPH

Flight Director
Staff member
LPH submitted a new resource:

How to Bridge PHP and XenForo 2 - Connecting to XenForo 2

In XF2, three lines are required. Create a file named connectXenForo2.php and add the following contents.

PHP:
<?php

/** @var  $fileDir */
$fileDir = '/Absolute/Path/To/xf2';

require($fileDir . '/src/XF.php');
XF::start($fileDir);

Now create a file named user.php

PHP:
<?php

require_once '../connectXenForo2.php';

$finder = \XF::finder('XF:User');
$user = $finder->where('user_id', 1)->fetchOne();

\XF::dump($user);

And the array is returned. BEAUTIFUL.

Read more about this resource...
 
Last edited:
Top