Forums / General / Using "fetch by owner"
Steph A
Friday 14 October 2005 9:54:21 pm
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*
Mazen Alsibai
Sunday 16 October 2005 3:05:47 am
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*}
Sunday 16 October 2005 10:32:45 pm
Of course... that worked ;)
Thank you very much!