Forums / Setup & design / Some kind of {section show=$user.is_logged}

Some kind of {section show=$user.is_logged}

Author Message

Federico Canuti

Monday 19 September 2005 9:31:02 am

I would like to create a section like
{section show=$node.object.can_create}
code
{section-else}
code
{/section}
but looking if the user is logged or not (and not using a permission policy or something, logged in the entire site even if he can't do anything).
Can you help me?
Thanks

Hans Melis

Monday 19 September 2005 9:37:20 am

Try this:

{def $current_user=fetch('user','current_user')}

{if $current_user.is_logged_in}
do stuff
{else}
do other stuff
{/if}

That syntax is of course only valid if your version >= 3.6.0. For lower versions, try your familiar let block with {section show=...}.

hth

Hans
http://blog.hansmelis.be

Federico Canuti

Monday 19 September 2005 4:54:15 pm

great thanks