Path

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


logged_in_users

Summary

Lists all logged-in users

Usage

fetch( 'user', 'logged_in_users',
       hash( [ 'sort_by', sort_by,]
             [ 'offset', offset, ]
             [ 'limit', limit ] ) )

Parameters

NameTypeDescriptionRequired
sort_by mixed Which field to sort by No.
offset integer Which offset to start fetching from No.
limit integer The maximum number of users to fetch No.

Returns

An array with users who are logged-in

Description

Will return an array with logged-in users who are considered active.
Each element is an eZUser object.

A user is considered active if the last access time is less than the activity timeout, the default is 1 hour and can be configured in site.ini ( ActivityTimeout).

The sort_by is an array with sorting types, each type is an array with the first element being the sort field and the second being the direction (boolean).
The following sorting fields are currently supported

  • user_id
  • login
  • activity
  • email

Note: It is usually a good idea to include a limit since the number of users can get long.

See also logged_in_list which does the same but returns just the name and ID.

Examples

The current users are logged in to the system

{section var=user loop=fetch( 'user', 'logged_in_users',

                              hash( 'limit', 10 ) )}

   {$user.name}

{/section}

Comments

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

01/06/2004
6:09:13 pm
by Jan Borsodi

Last updated

01/06/2004
6:33:20 pm
by Jan Borsodi

Authors

Jan Borsodi



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.