Sorry to bump up a year old thread. I'm trying to use Jerry's code on a Codeigniter based site however it looks like any code igniter commands that are run after loading in the xf_auth library dont work, as it is trying to run them as part of xenforo.
For example, a simple test controller in CI:
class Test extends Public_Controller
public function __construct()
echo "You're logged in to XenForo !" .
" User id :: " . $this->xf_auth->getUserId() .
" username :: " . $this->xf_auth->get('username') .
" email :: " . $this->xf_auth->get('email');
echo "You are not logged in";
With that model line there, I get this error:
You're logged in to XenForo ! User id :: 1 username :: Rick email :: firstname.lastname@example.org
An exception occurred: Only variables should be passed by reference in /Volumes/User Drive/htdocs/xxxxxxxxxx/site/system/cms/libraries/MX/Loader.php on line 178
XenForo_Application::handlePhpError() in /Volumes/User Drive/htdocs/xxxxxxxxxx/site/system/cms/libraries/MX/Loader.php at line 178
MX_Loader->model() in /Volumes/User Drive/htdocs/xxxxxxxxxx/site/addons/shared_addons/modules/xxx/controllers/test.php at line 37
call_user_func_array() in /Volumes/User Drive/htdocs/xxxxxxxxxx/site/system/codeigniter/core/CodeIgniter.php at line 352
require_once() in /Volumes/User Drive/htdocs/xxxxxxxxxx/site/index.php at line 259
Any ideas? Completely stumped. The XenForo integration seems to be working, but anything after that fails.