$users


Users Methods

$users->find("selector")

Introduced in Version 2.0

Description

Find user(s) matching given selector.

Examples

The following examples match strings that end with a value or that contain a value. You can find more operators on the Selector Operators page.

Note that this foreach() example below also applies to all examples below this – the foreach() has been left out of later examples for brevity.

Find all users whose email address ENDS with processwire.com and create a link to email them

$items = $users->find("email$=processwire.com");
foreach($items as $item) {
    echo "<li><a href='mailto:{$item->email}'>{$item->name}</a></li>";
}

Find all users who have "fred" anywhere in their name

$items = $users->find("name*=fred");

Find all users who have the "superuser" role

$items = $users->find("roles=superuser");

Related

Post Comment