Apropriate way to retrieve data on currently logged in user

Author Message

Michel Pfirter

Tuesday 19 February 2008 9:04:12 am

Hello All

I am quite new to eZ Publish and have therefore a basic question. I try to extend the class eZFilePassthroughHandler so it logs (to database) some information on the downloaded file.
The current logged in user should also be saved, and thats where my question comes in.
<b>Whats the apropriat way the get the current logged in users id inside of an other class?</b> I found the id in the Session and aswell a method in eZUser class to get the id, that is mentioned in the forums too.

            /* ... inside eZFilePassthroughHandler ... */
            require_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
            $user =& eZUser::currentUser();

Unfortunately this returns me nothing.

Thank you for your input and help.

Michel

Piotrek Karaƛ

Tuesday 19 February 2008 11:53:12 am

For example (eZ 4.0):

$currentUserObject = eZUser::instance();
$currentUserID = $currentUserObject->currentUserID();

?

Welcome to the community!

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Michel Pfirter

Wednesday 20 February 2008 1:09:33 am

Hi Piotrek

Thank you, that's it :)

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