$user


User Properties

$user->id

Introduced in Version 2.0

Description

Numeric ID of this user

You can get the user ID several ways:

echo $user->id; // returns 41 for the default admin user account

First, by specifically requesting the id field:

echo $user; // would still return 41

Second, by omitting the id or any other field names:

// Find all users who have the superuser role
$items = $users->find("roles=superuser");
echo $items; // could return 41|1524|1536 for example

The latter will also return a piped list of IDs if you have several users in a PageArray, which could then be used in other selectors:

Post Comment