Spent a good amount of time trying to return all Users that match a custom field value.
Reading the docs here, it shows a findAll()
command.
However, when trying the code below, it's not working.
use craft\elements\User;
$value = 'some string';
$users = User::findAll(['customField' => $value]);
return count($users);
The query doesn't fail, but rather, it times out. If I put in a non-valid custom field, an error is thrown.
Any ideas how to get a count of all Users that match a custom field value?
EDIT: This actually does work as expected! My code included a do/while loop, which was the issue. Leaving the questions up in case someone else is searching for this or has a different solution.