Path

ez.no / exponential / documentation / reference / data fetching / user / current_user


current_user

Summary

Fetches the user that is currently logged in.

Usage

fetch( 'user', 'current_user' )

Returns

An ezuser object.

Description

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

Examples

{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

Comments

Log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
Template functions
Data fetching
    Class
    Content
    Collaboration
    Layout
    Notification
    Package
    Section
    Shop
    URL
    User
       anonymous_count
       current_user
       is_logged_in
       logged_in_count
       logged_in_list
       logged_in_users
       member_of
       user_role
Modules
XML tags


Created

06/02/2004
1:51:40 pm
by Balazs Halasy

Last updated

12/02/2004
10:33:59 am
by Balazs Halasy

Authors

Balazs Halasy
B�rd Farstad



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.