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

Author Message

Jonny Bergkvist

Wednesday 14 May 2003 2:59:53 am

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

Paul Forsyth

Wednesday 14 May 2003 3:47:32 am

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 :)

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?

Claus Jensen

Wednesday 14 May 2003 4:56:46 am

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

Jonny Bergkvist

Wednesday 14 May 2003 5:37:55 am

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

Claus Jensen

Wednesday 14 May 2003 5:46:31 am

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 ;)

claÜs

John van der Boom

Wednesday 14 May 2003 6:49:53 am

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.

Scot Wilcoxon

Friday 16 May 2003 11:12:18 am

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?

Valentin Svelland

Wednesday 16 July 2003 6:01:36 am

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"

Valentin Svelland

Tuesday 11 November 2003 3:29:38 am

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

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