eZ Community » Forums » General » Using "fetch by owner"
expandshrink

Using "fetch by owner"

Using "fetch by owner"

Saturday 15 October 2005 6:54:21 am - 2 replies

Still having problems showing just the current users articles etc..

Does anyone have a working code for this?

I have tried this code

{*?template charset=utf-8?*}
<h1>User articles</h1>

{* Grab some of the content of the node that is being viewed. *}
{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
                                     attribute_filter,
                                     array( array( 'owner', '=', $current_user.contentobject_id ) )) )}

{* LOOP: For each child of the node... *}
{section name=Child loop=$children}

    {* Display the content of the child using a line-view template. *}
    {node_view_gui view=line content_node=$Child:item}

    <hr>

{* End of loop. *}
{/section}

{* End of namespace. *}
{/let}

..and then it returns

Unknown template variable 'current_user' in namespace ''

I am a newbie to this, so its probably something basic....or?

*please help*

Sunday 16 October 2005 12:05:47 pm

Hi:
you have to fetch the current user like this:
{let current_user=fetch('user','current_user')}
<h1>User articles</h1>

{* Grab some of the content of the node that is being viewed. *}
{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
attribute_filter,
array( array( 'owner', '=', $current_user.contentobject_id ) )) )}

{* LOOP: For each child of the node... *}
{section name=Child loop=$children}

{* Display the content of the child using a line-view template. *}
{node_view_gui view=line content_node=$Child:item}

<hr>

{* End of loop. *}
{/section}

{* End of namespace. *}
{/let}
{/let}{*fetch user*}

Monday 17 October 2005 7:32:45 am

Of course... that worked blunk.gif Emoticon

Thank you very much!

expandshrink

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

36 542 Users on board!

Forums menu