Forums / Developer / Apropriate way to retrieve data on currently logged in user

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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 Exponential 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 :)