eZ Community » Forums » Setup & design » Show author of a content-object (ie....
expandshrink

Show author of a content-object (ie. an article)

Show author of a content-object (ie. an article)

Wednesday 14 May 2003 11:59:53 am - 8 replies

I would like to show the name of the author/creator of every article.

To do this I will modify the template: design/<sitedesign>/override/templates/node/view/full_class_2.tpl.

I can get the numeric value (uid) of the creator with this template-code:
{$content_version.creator_id}

But how do I get the name?

Jonny Bergkvist

Wednesday 14 May 2003 12:47:32 pm

Try other attributes for that class. This code will
show all attributes of $content_version:

{$content_version|attribute(show,1)}

You may notice a attribute named 'data_map'. This holds
the attributes for your class 2, so:

{$content_version.data_map|attribute(show,1)}

will show your attributes and values. This is a very helpful
debugging method happy.gif Emoticon

A better way to display attributes is through:

{attribute_view_gui attribute=$content_version.data_map.name}

This will render your attribute using standard ez code for whatever datatype the attribute happens to be. Text is easy to display but files, images, etc?

Modified on Wednesday 14 May 2003 12:55:43 pm by Paul Forsyth

Wednesday 14 May 2003 1:56:46 pm

I think this one is better: {$node.creator.name}

Wednesday 14 May 2003 2:37:55 pm

Thanx Claus, your solution worked (of course).

My struggle with this was because I made the article I tested against a few weeks ago, and I had forgotten that I made this test-article to test what happened when I deleted the user that created the article !!!

(And the answer to that is that if you delete a user, then the content that the user created get the $content_version.creator set to NULL)

Jonny Bergkvist

Wednesday 14 May 2003 2:46:31 pm

Aha!! That explains the error messages im getting on one of my pages I think.
Glad to help you... now you helped me right back blunk.gif Emoticon

claÜs

Wednesday 14 May 2003 3:49:53 pm

How did/do you change the creator of this object (article) using the admin interface?

Or should I adapt the interface of article-editing to do this kind of job?
Why I'm asking?
I noticed that when a person edit the article, {$content_object.creator.name|wash} shows the name of this person and not the first person who wrote it.

Modified on Wednesday 14 May 2003 4:00:05 pm by John van der Boom

Friday 16 May 2003 8:12:18 pm

I suspect the creator is different for a different version because of the version handling. To get the creator of the original article, perhaps you have to retrieve version 0...or is that 1?

Wednesday 16 July 2003 3:01:36 pm

I've got no problem showing the article's author, but what if the article is altered by someone else at a later stage? The the articles gets a new creator it seems. Is there a way to keep the original creators name, and perhaps rather credit the latter author as "Altered by: OthersUsersName"

Tuesday 11 November 2003 12:29:38 pm

Anyone know how to keep original authors name, and place other (later) editor's name under a "Modified by:"-header..?

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from