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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:01:25
Script start
Timing: Jan 18 2025 02:01:25
Module start 'layout'
Timing: Jan 18 2025 02:01:25
Module start 'content'
Timing: Jan 18 2025 02:01:26
Module end 'content'
Timing: Jan 18 2025 02:01:26
Script end

Main resources:

Total runtime1.6755 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0469152.6406
Module start 'layout' 0.00580.0030 740.687539.4844
Module start 'content' 0.00881.6652 780.1719533.8750
Module end 'content' 1.67400.0014 1,314.046912.1250
Script end 1.6754  1,326.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.1895160.0002
Check MTime0.00140.0828160.0001
Mysql Total
Database connection0.00070.044010.0007
Mysqli_queries1.616296.4600570.0284
Looping result0.00070.0412550.0000
Template Total1.636397.720.8181
Template load0.00190.113120.0009
Template processing1.634497.548520.8172
Template load and register function0.00020.010610.0002
states
state_id_array0.00130.074910.0013
state_identifier_array0.00180.108620.0009
Override
Cache load0.00150.0886170.0001
Sytem overhead
Fetch class attribute can translate value0.00090.055920.0005
Fetch class attribute name0.00140.082040.0003
XML
Image XML parsing0.00090.052020.0004
class_abstraction
Instantiating content class attribute0.00000.000540.0000
General
dbfile0.00070.0446170.0000
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs