Jump to content

Recommended Posts

Posted

Ryan, referring to your example in new user system i'm trying to get some users using this code:

$role  = wire('roles')->get("superuser"); 
$users = wire('users')->find("role=$role,sort=name");

but i get this strange error:

ProcessWire Error:Exception: Field does not exist: role (in /home/videog/public_html/wire/core/PageFinder.php line 244)
Posted

It's a typo, where did you find it? I'd like to correct it. It should be:

$users = wire('users')->find("roles=$role,sort=name");

Note "roles=" (plural) above, not "role=". There is no built-in field called "role" in ProcessWire so the error message you got is correct that the field does not exist.

Posted

Thanks, I've fixed that. That particular post was written before the new user system was, so those code examples were approximations but still want to keep them correct.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...