How to list only articles from logged in user?

Author Message

Arman Manutscheri

Monday 03 May 2004 9:45:26 am

Hi

How can I make a list of all articles created by the current user?
As I'm new to ez publish, i need a step-to-step answer ;-)
thanks

Nicolas Heiringhoff

Tuesday 04 May 2004 8:14:51 am

We have the same problem over here. Each article (or object of a class) has an "owner_id". So it would be very easy, if you could make an attribute_filter for the object on the owner_id. If you read the forum messages, this does not seem to be implied in ez publish yet. An other possibility is the sorting by author, because every article can be identified by its author. We do not have a proper solution for that yet. What we can do is this:

we have added a textfield to the article class, where you type in the username or author manualy (of course this should be done automatically, but we do not have a solution for this problem now). this textfield has the identifier "username" for example.

{let user=fetch( 'user', 'current_user' )}
   {$user.contentobject.name}
{/let}

gives you the current user

so you can sort the articles with this attribute filter on the "username"


{let user=fetch( 'user', 'current_user' )}
   
 {section loop=fetch( 'content', 'list', hash( parent_node_id, 47 , attribute_filter, array( array( 'article/username', '=', $user.contentobject.name ) ) ) ) }

 <a href={$:item.url_alias|ezurl}>{$:item.name}</a><br>

 {/section}

{/let}

This works here, but the main flaw is of course that you have to fill in the username manually. As we have the same problem and we are working on it, we will let you know, if we have come up with a more elegant solution!

http://www.heiringhoff.de

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