Forums / Developer / eZUser::isUserLoggedIn returns true for anonymous

eZUser::isUserLoggedIn returns true for anonymous

Author Message

Horst Lindlbauer

Wednesday 18 May 2011 7:26:44 am

I tried several methods to check if user is logged in.

The most convenient method would be:

$userId = eZUser::currentUserID();
eZUser::isUserLoggedIn($userId);

But this returns true even if no user is logged in and $userId is '10' (= anonymous). I even tried calling
eZUser::cleanupCache();
eZUser::clearSessionCache();
before. Same result.

So the only reliable method to get loggedin-information seems to be:

$user = eZUser::currentUser();
$user->isLoggedIn();

---------------------------------------
http://www.lbm-services.de

André R.

Wednesday 18 May 2011 2:54:02 pm

Version? There was something like this in 4.4 that was fixed but might not be the same issue.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Horst Lindlbauer

Thursday 19 May 2011 3:42:36 am

We are using 4.3.0

---------------------------------------
http://www.lbm-services.de