grantus
Active member
I've been using this code for a long time now and it works great:
When I have my own custom page I use this code to fetch the $user_id but is there a way to check if the page itself is a node or a page? Because if it's a node then it fails because of this code:
So I'd like to be able to simply do something like:
Code:
$fileDir = '/path/to/public_html';
require($fileDir.'/src/XF.php' );
\XF::start($fileDir);
$app = \XF::setupApp('XF\Pub\App');
$app->start();
$visitor = \XF::visitor();
$user_id = $visitor['user_id'];
When I have my own custom page I use this code to fetch the $user_id but is there a way to check if the page itself is a node or a page? Because if it's a node then it fails because of this code:
Code:
$fileDir = '/path/to/public_html';
require($fileDir.'/src/XF.php' );
\XF::start($fileDir);
$app = \XF::setupApp('XF\Pub\App');
$app->start();
So I'd like to be able to simply do something like:
Code:
//// IF PAGE ////
$fileDir = '/path/to/public_html';
require($fileDir.'/src/XF.php' );
\XF::start($fileDir);
$app = \XF::setupApp('XF\Pub\App');
$app->start();
//// END IF PAGE ////
$visitor = \XF::visitor();
$user_id = $visitor['user_id'];