Forums / Setup & design / How to display the user image

How to display the user image

Author Message

Pascal France

Sunday 28 May 2006 12:29:31 pm

Hi,

I would like to display the user image (the one which admin can upload when he creates a new user).
I found this post:
http://ez.no/community/forum/general/user_image
and tried the given solution without success.

{$user|attribute(show)} doesn't display any image attribute.

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Pascal France

Friday 26 May 2006 8:23:37 am

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Marcin Drozd

Sunday 28 May 2006 4:06:37 pm

Hi Pascal
Which user?
user who is currently logged in or owner of current object? mayby all users?

if you want to display image of current user:

{def $user=fetch( 'user', 'current_user' ) }
{if $user.data_map.image.has_content}
   {attribute_view_gui attribute=$user.data_map.image image_class=small}
{/if}
U have to be logged in (anonymous has not a photo)
(U can use {if $user.is_logged_in} too)

if U want to display owner' image:

{def $owner=$node.object.owner $owner_map=$owner.data_map}
{if $owner_map.image.has_content}
{attribute_view_gui attribute=$owner_map.image image_class=small}
{/if}
{undef}

for all users use:

{def $users=fetch( 'content', 'list', hash(parent_node_id, USERS_GROUP_NODE_ID) ) }
{foreach $users as $user}
 {if $user.data_map.image.has_content}
   {attribute_view_gui attribute=$user.data_map.image image_class=small}
 {/if}
{/foreach}

http://ez-publish.pl

Pascal France

Sunday 28 May 2006 11:58:11 pm

Hi Marcin,

Yes, it is the image of the logged user I want to display.
I don't know why, but:

{def $user=fetch( 'user', 'current_user' )}
{if $user.is_logged_in}
 {attribute_view_gui attribute=$user.data_map.image image_class=small}
{/if}

does not return anything.

As I told in my first post, {$user|attribute(show)} doesn't display any "image" attribute, then I think "data_map.image" can't work.

The admin interface uses this template:
design/admin/templates/content/edit.tpl
which includes:
design/admin/templates/content/edit_attribute.tpl
which uses this other one:
design/standard/templates/content/datatype/edit/ezimage.tpl
to display the user image in the user edit view (this line:
{attribute_view_gui image_class=ezini( 'ImageSettings', 'DefaultEditAlias', 'content.ini' ) attribute=$attribute} displays the user image).

First, I don't understand how edit_attribute.tpl calls ezimage.tpl ?
Second, I don't understand how to reuse:

{attribute_view_gui image_class=ezini( 'ImageSettings', 'DefaultEditAlias', 'content.ini' ) attribute=$attribute}

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Marcin Drozd

Monday 29 May 2006 12:41:33 am

I have found a mistake:
should be:

{attribute_view_gui attribute=$user.contentobject.data_map.image image_class=small}

and it works

http://ez-publish.pl

Pascal France

Monday 29 May 2006 12:56:02 am

Thinks a lot Marcin.

Now it works.
I looked for in the documentation but I didn't found anywhere how to do that.

Is there other attributes I can access with $user.contentobject ? How can display the list of these attributes ?

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Marcin Drozd

Monday 29 May 2006 1:24:49 am

Hi
U can use

{$user.contentobject|attribute(show,1)}
{$user.contentobject|attribute(show,2)}, etc.but be careful with 4, 5 !!

try with too:
{$user|attribute(show,2)}

http://ez-publish.pl

eZ debug

Timing: Jan 31 2025 01:35:36
Script start
Timing: Jan 31 2025 01:35:36
Module start 'content'
Timing: Jan 31 2025 01:35:36
Module end 'content'
Timing: Jan 31 2025 01:35:36
Script end

Main resources:

Total runtime0.3072 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 587.9297370.2969
Module start 'content' 0.00730.0123 958.22661,009.5313
Module end 'content' 0.01950.2876 1,967.75783,897.9688
Script end 0.3071  5,865.7266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00451.4774200.0002
Check MTime0.00130.4224200.0001
Mysql Total
Database connection0.00060.207110.0006
Mysqli_queries0.208567.87141410.0015
Looping result0.00180.57721390.0000
Template Total0.287293.510.2872
Template load0.00090.287410.0009
Template processing0.286393.181310.2863
Override
Cache load0.00060.207410.0006
Sytem overhead
Fetch class attribute can translate value0.00160.519210.0016
XML
Image XML parsing0.00030.097010.0003
General
dbfile0.00642.0933200.0003
String conversion0.00000.002330.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs