Forums / Developer / Apropriate way to retrieve data on currently logged in user
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
Wednesday 20 February 2008 1:09:33 am
Hi Piotrek
Thank you, that's it :)