Share » Forums » Developer » How do i get the current user in my...

How do i get the current user in my php script?

How do i get the current user in my php script?

Thursday 12 June 2003 9:53:16 am - 4 replies

Modified on Thursday 12 June 2003 10:03:13 am by Douglas Hammond

Author Message

Sven Ryen

Thursday 12 June 2003 10:43:34 am

don't know if this is to any help, but the user datatype is found here:

/kernel/classes/datatypes/ezuser/ezuser.php

Seems to me like you might want to extend the eZUser class.. Somebody please correct me if there's an easier way to accomplish this.

Bård Farstad

Thursday 12 June 2003 10:45:32 am

This is done with eZUser::currentUser(); that will return an eZUser object with the current logged in user.

Note that the user is a datatype, which is a part of a content object. To get access to the attributes you need to fetch the contentobject from the user object.

--bård

Documentation: http://ez.no/doc

Douglas Hammond

Friday 13 June 2003 7:03:11 am

Thanks that's exactly what I was wondering. So I must get the content object that corresponds to the user. What datameber of ezUser corresponds to the contentId

is this right?

$user = &eZUser::currentUser();
$userObject = &$user->attribute( "contentobject" );

Jo Henrik Endrerud

Friday 13 June 2003 7:26:17 am

After a quick check in the code it looks like you can do both. I think both will give the same result

Jo Henrik Endrerud | System Developer @ Seeds Consulting | http://www.seeds.no

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu