Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.



Fetches the names of the users that are logged in.


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


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.


An associative array or FALSE.


This function will fetch all the logged in users and return an associative array. The keys of the returned hash will be the user ID numbers; the values will be the users' names. 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


Example 1

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

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)


There are no comments.