eZpedia : The Free eZ Publish CMS Documentation Encyclopedia

Snippet: Template logic to display user session switching html form

About

If a user is logged in, display their name + logout button, if not, than display a login form.

Submited via irc by Lukasz Serwatka

{let thisuser=fetch('user','current_user')}
{section show=$thisuser.is_logged_in}
<p>Welcome. You are logged in as {$thisuser.contentobject.name}</p>
<p><a href="/user/logout">Logout</a></p>
{section-else}
<!-- login form goes here -->
{/section}
{/let}

Article provided by eZpedia

All text is available under the terms of the GNU Free Documentation License

Powered by eZ Publish Community Project 4.2011

Hosted by Swiss eZ Publish partner YMC