logged_in_list
Summary
Fetches the names of the users that are logged in.Usage
fetch( 'user', 'logged_in_list', hash( [ 'sort_by', sort_by, ] [ 'offset', offset, ] [ 'limit', limit ] ) )
Parameters
Name | Type | Description | Required |
---|---|---|---|
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 associative array or FALSE.
Description
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
Examples
Example 1
{def $users=fetch( 'user', 'logged_in_list', hash( 'sort_by', array( array( 'login', true() ) ) ) )} {foreach $users as $user} {$user} <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.