WSWD
Well-known member
I'm sure there is a very simple fix, but after hours of coding, I'm just not seeing it.
Using the following code to get the user info:
That works great when I use this in a file in the root directory (i.e. public_html/). As soon as I move the file to a subdirectory (i.e. public_html/directory), it no longer works.
This doesn't make any sense as there are no relative paths in the code...only absolute paths. Any help would be greatly appreciated.
Thanks!
Using the following code to get the user info:
Code:
define('XF_ROOT', '/home/hydro/public_html/forum/'); // set this!
define('TIMENOW', time());
define('SESSION_BYPASS', false); // if true: logged in user info and sessions are not needed
require_once(XF_ROOT . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader(XF_ROOT . '/library');
XenForo_Application::initialize(XF_ROOT . '/library', XF_ROOT);
XenForo_Application::set('page_start_time', TIMENOW);
XenForo_Application::disablePhpErrorHandler();
XenForo_Application::setDebugMode(false);
if (!SESSION_BYPASS)
{
XenForo_Session::startPublicSession();
$visitor = XenForo_Visitor::getInstance();
if ($visitor->getUserId())
{
$userModel = XenForo_Model::create('XenForo_Model_User');
$userinfo = $userModel->getFullUserById($visitor->getUserId());
}
}
restore_error_handler();
restore_exception_handler();
That works great when I use this in a file in the root directory (i.e. public_html/). As soon as I move the file to a subdirectory (i.e. public_html/directory), it no longer works.
This doesn't make any sense as there are no relative paths in the code...only absolute paths. Any help would be greatly appreciated.
Thanks!