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.

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

eZ debug

Timing: Jan 19 2025 07:23:48
Script start
Timing: Jan 19 2025 07:23:48
Module start 'layout'
Timing: Jan 19 2025 07:23:48
Module start 'content'
Timing: Jan 19 2025 07:23:48
Module end 'content'
Timing: Jan 19 2025 07:23:48
Script end

Main resources:

Total runtime0.8517 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 590.5469152.6563
Module start 'layout' 0.00800.0039 743.203139.5234
Module start 'content' 0.01190.8382 782.7266553.5625
Module end 'content' 0.85010.0016 1,336.289112.0938
Script end 0.8517  1,348.3828 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4056160.0002
Check MTime0.00130.1549160.0001
Mysql Total
Database connection0.00110.125310.0011
Mysqli_queries0.790592.8045600.0132
Looping result0.00070.0834580.0000
Template Total0.819496.220.4097
Template load0.00230.267220.0011
Template processing0.817195.935120.4086
Template load and register function0.00020.027210.0002
states
state_id_array0.00070.083510.0007
state_identifier_array0.00070.087620.0004
Override
Cache load0.00210.2413370.0001
Sytem overhead
Fetch class attribute can translate value0.00110.132520.0006
Fetch class attribute name0.00100.115350.0002
XML
Image XML parsing0.00070.077020.0003
class_abstraction
Instantiating content class attribute0.00010.006460.0000
General
dbfile0.00090.1052170.0001
String conversion0.00000.001640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs