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.

eZ debug

Timing: Jan 19 2025 04:40:26
Script start
Timing: Jan 19 2025 04:40:26
Module start 'content'
Timing: Jan 19 2025 04:40:28
Module end 'content'
Timing: Jan 19 2025 04:40:28
Script end

Main resources:

Total runtime1.4298 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 589.2266180.7969
Module start 'content' 0.00571.2668 770.0234558.6719
Module end 'content' 1.27250.1572 1,328.6953336.7109
Script end 1.4297  1,665.4063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00470.3309210.0002
Check MTime0.00160.1141210.0001
Mysql Total
Database connection0.00070.048710.0007
Mysqli_queries1.345094.07081970.0068
Looping result0.00220.15471950.0000
Template Total1.391797.320.6959
Template load0.00240.167720.0012
Template processing1.389397.169720.6946
Template load and register function0.00020.011010.0002
states
state_id_array0.00120.083410.0012
state_identifier_array0.00240.166020.0012
Override
Cache load0.00200.1417370.0001
Sytem overhead
Fetch class attribute can translate value0.00170.118430.0006
Fetch class attribute name0.00240.168450.0005
XML
Image XML parsing0.00100.070030.0003
class_abstraction
Instantiating content class attribute0.00000.001560.0000
General
dbfile0.00330.2337280.0001
String conversion0.00000.000330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs