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:
PHP:
class Test extends Public_Controller
{
public $data;
public function __construct()
{
parent::__construct();
}
function index()
{
$this->load->library('xf_auth');
if($this->xf_auth->isLoggedIn())
{
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');
}
else
{
echo "You are not logged in";
}
$this->load->model('some_model_name');
}
}
With that model line there, I get this error:
Code:
You're logged in to XenForo ! User id :: 1 username :: Rick email :: xxxxxx@xxxxxx.com
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
Test->index()
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.