Forums / Setup & design / How do I list user related content?

How do I list user related content?

Author Message

Knut Urdalen

Tuesday 15 January 2008 8:16:39 am

<b>Problem</b>
I'm building a news site and each author is getting it's own profile page. On this profile page I want to list the latest articles the author has written.

<b>Description</b>
I'm migrating a lot of old content so the creator of the content node is not necessarily the same as the actual author.

The standard "Article" class has a "author" property using the "ezauthor" datatype where I can store both name and email of one or more authors. I want to use this content to match against the list of users on the system.

My current try (using content fetch tree with attribute filter):

{def $news_parent_id = ezini('News', 'ParentID', 'client.ini')}
{def $news = fetch('content', 'tree', 
                                  hash( 'parent_node_id', $news_parent_id,
                                             'attribute_filter', array(array($node.data_map.user_account.content.email, 'in', 'article/author/email'))
))}

Obviously this does not work. Any ideas?

I've scanned through http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/list
with no luck. Maybe I'm missing something...

Piotrek Karaś

Tuesday 15 January 2008 12:16:28 pm

Hi Kunt,

Methodology seems fine to me, since by default system users' emails are kept unique (you would need to ensure that it remains so). I just don't think it will be that easy in the template layer. Not saying it's not possible, I just don't see it ;) I would expect much more luck with eZ API.

I'll be facing similar problem quite soon, but I will most probably rely on content ownership rather than any other key.

Good luck,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Knut Urdalen

Wednesday 16 January 2008 6:39:00 am

There is a conflict here system wise because the content author is not necessarily the one responsible for the actual publishing. Since the owner/creator of the content object is set to the one that was putting the content object into the eZ Publish database, relying on it wouldn't help me much.

Do you have any idea about where to look in the eZ API to accomplish this task?

André R.

Wednesday 16 January 2008 11:42:10 am

Extended attribute filter probably, or have auther object id as a parameter.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Wednesday 16 January 2008 11:57:01 am

Yes, I can see the conflict - ownership vs. authorship seems to be quite a tricky issue.

But getting technical, a stream of (un)consciousness... authors are stored in ezcontentobject_attribute database table as XML (data_text field):

<?xml version="1.0" encoding="utf-8"?>
<ezauthor><authors><author id="0" name="Author Name" email="author@email.address.com"/></authors></ezauthor>

which means no easy direct access to their e-mail addresses. But if you can afford a periodical update of the linked content, then you could simply create your own table set for linking authors to content by processing these XMLs from time to time. Actually, seems to me that ezauthor datatype could be extended into a managed solution, which in architecture would resemble ezkeyword. And even an easier way - if you still want to rely on the author's e-mail - why don't you extend the ezauthor datatype by additionally saving md5( 'email@address' ) in one of the attribute's data_text fields. Then, just one simple SQL query would find all hashes of a given e-mail, thus providing contentobject_id. And that would naturally require writing the datatype class extensions as well as own operator to send results to templates.

That's the first ideas that came to my mind.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu