$users


Users Methods

$users->get(name|id|selector)

Introduced in Version 2.0

Description

Get user by given name, numeric ID or a selector string.

Examples

Get user by name

Find a user whose name is fred (match entire string, not case sensitive) and echo their email address and user ID.

$item = $users->get("fred");
echo $item->email;
echo $item->id;

Get user by ID

For the purposes of this example, 41 is the ID of the admin user created during installation.

$item = $users->get(41);
echo $item->name;

Get user by selector string

Find a user whose email address matches example@processwire.com

$item = $users->get("email=example@processwire.com");
echo $item->name;

Related

Post Comment