Logged in User's ID in Memcache

Not open for further replies.

I have enabled Memcached as a backend for caching system. I am developing a plugin in which I need to get the ID of the logged in user. Can someone help me out to find as to how can I retrieve the ID when memcached is enabled.
P.S the following code snippet that I had used which did not work:

if($userid == 0){
$fileDir = dirname(dirname(__FILE__));
require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
$visitor = XenForo_Visitor::getInstance()->toArray();
$userid = $visitor['user_id'];
This code helped me get the userid, but throws a Fatal error while re-installing my plugin.
Please help.


XenForo developer
Staff member
Please associate your forum user with your customer account. You will then be able to post in the development section.
Not open for further replies.