current_user

Summary

Fetches the user that is currently logged in.

Usage

fetch( 'user', 'current_user' )

Returns

An ezuser object.

Description

This function fetches the user object for the user that is currently logged in. If no user is logged in, the anonymous user will be returned. In both cases, the function will return an ezuser object.

Examples

Example 1

{def $user=fetch( 'user', 'current_user' )}
User:     {$user.contentobject.name} <br />
E-mail:   {$user.email} <br />
Username: {$user.login} <br />
Group(s): {$user.groups|implode(', ')} <br />

Outputs miscellaneous information about the user that is currently logged in.

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