Jump to content

field role does not exist


Frank Vèssia
 Share

Recommended Posts

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)
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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