ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

logged_in_users

Summary

Fetches the users that are logged in.

Usage

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

Parameters

NameTypeDescriptionRequired
sort_by mixed The field that should be used by the sorting mechanism. No.
offset integer The offset to start at. No.
limit integer The number of users that should be fetched. No.

Returns

An array with ezuser objects or FALSE.

Description

This function will fetch all the logged in users and return an array containing ezuser objects. If no users are logged in, FALSE will be returned. The "sort_by", "offset" and "limit" parameters are optional.

A user is considered to be active / logged in if the last access time is within the range of the activity timeout. The timeout can be set using the "ActivityTimeout" directive in a configuration override for "site.ini". The default timeout is one hour.

The "sort_by" parameter must be specified as an array. Each element of the array must be another array where the first element denotes the field (as a string) that the sorting mechanism should use. The second element specifies the direction of the sort (as a boolean). The following sorting fields can be used:

  • user_id
  • login
  • activity
  • email

Examples

Example 1

{def $users=fetch( 'user', 'logged_in_users',
                   hash( 'sort_by', array( array( 'login', true() ) ) ) )}
 
{foreach $users as $user}
    {$user.contentobject.name} <br />
{/foreach}

Outputs the names of the users that are currently logged in (sorted by usernames).

Balazs Halasy (01/06/2004 4:09 pm)

Balazs Halasy (06/06/2005 11:54 am)


Comments

There are no comments.