ez.no / exponential / documentation / reference / data fetching / user / current_user
fetch( 'user', 'current_user')
An ezuser object.
Returns the user that is currently logged in. If no user is logged in, the anonymous user will be returned. This function will return an ezuser object. The ezuser object consists of the following:
contentobject_id string login string email string password_hash string password_hash_type string contentobject object[ezcontentobject] groups array has_stored_login boolean original_password boolean original_password_confirm boolean roles array role_id_list array is_logged_in boolean
{let user=fetch( 'user', 'current_user' )} User: {$user.contentobject.name}<br /> Email: {$user.email}<br /> Login: {$user.login}<br /> Group(s): {$user.groups|implode(', ')}<br /> {/let}
The code above will fetch the current user and print various information like the username, email address, etc. If the anonymous user is fetched (no user is logged in) then this will result in the following output:
User: Anonymous User
Email: nospam@ez.no
Login: anonymous
Groups: 42
Log in or create a user account to comment.
Comments