This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Finding the email-adress...
expandshrink

Finding the email-adress...

Finding the email-adress...

Sunday 19 January 2003 11:42:01 am - 11 replies

I have a full_class_*.tpl for an article content object that shall display both the authors name and email-adress. The authors name is no problem, this is found via the {$content_object.owner.name} (or {$node.object.owner.name} if one prefers) but how the he.. do I find the rest of the userdata (from ezuser) for the owner/creator...?

As I understand the owner.name refers to ezcontentobject (in the DB) referred from the ower_id field - yes, I looked in the DB-structure. In this case the author will allways be the one that has written the article.

So, how to get the data from the table ezuser where the email-adress is stored?

\atle\
--

Thursday 16 October 2003 2:13:59 pm

Atle,
did you ever solve this?? I really need the solution to this also.

Thursday 16 October 2003 3:52:28 pm

This is what I use in a line view template:

$node.contentobject_version_object.creator.contentobject_attributes.2.content.email}

Sometimes you have to dig deep blunk.gif Emoticon

-paul

Thursday 16 October 2003 4:26:44 pm

It worked!! Thank you!
Can you explain how one should normally find these things? What should I have been looking at to find that attribute on my own? So that when I need something else I can try to help myself.

Thursday 16 October 2003 5:41:08 pm

{$node|attribute(show,<level>blunk.gif Emoticon}

With <level> set to a large depth, the default is 2 (large output too, you're warned)

-paul

Thursday 16 October 2003 6:34:34 pm

Tres Cool! Thanks.

Friday 17 October 2003 9:56:32 am

A better way of accessing the user data is to trough the data_map attribute, the data_map will return an array with all content attributes where the content attribute identifier is the lookup name, in this case it's user_account which is defined by the User content class.

The line would then be
{$node.contentobject_version_object.creator.data_map.user_account.content.email}

Some more info on the data_map can be read here:
http://ez.no/developer/ez_publish...ion/customization/custom_design/node

Saturday 18 October 2003 9:31:26 am

Jan, your method seems easier but when you say 'better' do you mean that it is more reliable? Would the two methods allways return the same value or are their circumstances that would cause them to return a different value? For example, is one the email of the creator (of the first version) and the other the email of the last editor (creator of the current version)?
I'm trying to use this in each item of the shop basket so that I can send an email to {$basket.items.....contentobject_version_object.creator.data_map.user_account.content.email}

Modified on Saturday 18 October 2003 9:43:37 am by Luc Chase

Saturday 18 October 2003 9:58:04 am

Eureka!!!!
{$Basket:ProductItem:item.item_object.contentobject.main_node.contentobject_version_object.creator.data_map.user_account.content.email}
or
{$Basket:ProductItem:item.item_object.contentobject.main_node.contentobject_version_object.creator.contentobject_attributes.2.content.email}
Thanks to Paul and Jan!... now how to e-mail the order (including header details) with only this item....

Modified on Saturday 18 October 2003 10:33:22 am by Luc Chase

Saturday 18 October 2003 1:09:03 pm

With lines of this length its a good idea to create some useful variables:

{let my_datamap=$Basket:ProductItem:item.item_object.contentobject.main_node.contentobject_version_object.creator.data_map}

{$my_datamap.user_account.content.email}
{$my_datamap.others...}
{/let}

With the second example you can be neater:

{let my_attributes=$Basket:ProductItem:item.item_object.contentobject.main_node.contentobject_version_object.creator.contentobject_attributes}

{attribute_view_gui attribute=$my_attributes.2.content.email}

{/let}

and so on.

Saves using scroll bars blunk.gif Emoticon

paul

Modified on Saturday 18 October 2003 1:12:22 pm by Paul Forsyth

Saturday 18 October 2003 2:30:13 pm

Do you think there is a simple way to send an email to the 'creator/owner' of the item in the basket (along with the order header i.e. who is ordering it.)?

Modified on Saturday 18 October 2003 2:35:22 pm by Luc Chase

Wednesday 22 October 2003 2:18:51 pm

> Jan, your method seems easier but when you say 'better' do
> you mean that it is more reliable?

Yes, the first one relies on the order/placement of the attribute while the second (data_map) relies on the name of the attribute. Order/placement may change but the identifer name rarely change (if ever).
The other advantage with identifier names is that you can use the same identifier in multiple classes and just have one template for all of them (or PHP code for that matter).

Generally you shouldn't change the identifier name (You can still change the displayed name) in a class once objects has been made from it, that ensures that your templates don't need any changes to them.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from