Logged in User's ID in Memcache

Status
Not open for further replies.
#1
Hello,

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);
XenForo_Session::startPublicSession();
$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.
 

Mike

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