Jump to content

Options field: users as values


pppws
 Share

Recommended Posts

hey there,

i'm using processwire for the first time, so maybe it's a dumb question. but i'm trying to have an options field which values are the users of the processwire. i don't need the values to be displayed, it's just for the administration of the page. but each time a new user is created / a user is deleted the options field should be updated automatically. is something like that possible?

Link to comment
Share on other sites

This is a perfect use case for Page Reference field.

  • Create a new field from Setup > Fields > Add New. Give it a name. Set its type as Page Reference. Save.
  • If you want to select a single user, specify so on the Details tab, 
  • Switch to Input tab, set input type to Select. (Optionally install InputfieldPageAutocomplete core module to enable input with auto-completion capabilities)
  • From Selectable Pages, set template to user. Optionally, use Custom Find and specify template as user, and a role, or any other field you like.
  • Add the field to a template.

Inside your template file, you can get the user using $page->userFieldName

 

  • Like 6
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

×
×
  • Create New...