views:

55

answers:

1

How do I use the form API to make a field that only accepts names of registered users? I know how to do the autocomplete to suggest user names already.

Specifically, I'm looking to replicate the field in the normal node creation process that allows the user to specify an author.

A: 

The user module doesn't have a user list function, but a simple database query will get you that. Then in the form_validate function, you can check that the entered name really is a valid user with user_authenticate.

Elise van Looij