Forums / Developer / When creating a module how do you access current_user information?

When creating a module how do you access current_user information?

Author Message

Kenneth Colwell

Thursday 04 March 2004 1:29:24 pm

It seems that there must be some method of passing information from ezpublish to your own custom modules. But I'm unable to locate this information in the docs, wiki, etc.

Please help.

Thanks,
Ken Colwell

Paul Borgermans

Thursday 04 March 2004 1:34:43 pm

What are you looking for?

As it is your module/function it will be called from somewhere else. And in this somewhere else, you could add any argument in the url to your module (or a key to fetch it from the rest of the ezp kernel/libs)

------------------------------------------------
edit:

Like for instance

$user =& eZUser::currentUser();

to return the current user object which holds the basic attributes of the ezuser datatype.
---------------------------------------

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paul Borgermans

Thursday 04 March 2004 1:48:29 pm

With respect to the docs:

You won't find many things there, but by studying the code and the API doxygen docs may help you a little:

http://pubsvn.ez.no/doxygen/hierarchy.html

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Kenneth Colwell

Friday 05 March 2004 7:05:57 am

Thanks for the information Paul it has been really helpful.

I didn't want to use the url method of passing information since I'm working on a form system that requires identifying the user completing of the form. If I passed the information via the URL then the person could simply change the url to something different.

As I was looking through the code for ezuser I didn't see anyway to get the users full name. I can get the login, email address and id but there doesn't seem to be a method for accessing the full name of the person.

I thought that I was going to get something by using $name =& eZUserType::title($user["Login"]);

That took me to this error: Fatal error: Undefined class name 'ezusertype'
Which I resolved by including: include_once("kernel/classes/datatypes/ezuser/ezusertype.php");

Which got me to this error: Fatal error: Call to undefined function: objectattributecontent()

This must be an inaccurate error message since the next function defined in ezusertype is: function &objectAttributeContent

So, I'm guessing that I'm either trying to access the eZUserType::title function wrong or I'm just completely lost in space.

Thanks,
Ken C.