You could do this with custom validation using the gform_validation hook. You would populate the list of acceptable usernames (selected from your WordPress database using whatever criteria is important to you) and then compare the submitted username to the list of usernames. If there is no match, return a validation error. If there is a match, continue.
1000 usernames can be returned from a MySQL database fairly quickly and the array functions in PHP are pretty fast, so I don't think this will be a problem. You'll have to try it out and see and improve it as necessary. For example, instead of pulling all the names of a certain role, you could search the database for a match on the one username that was submitted in the form. No match means they get a validation error. Doing it this way would be no problem at all with 1000 records.
Posted 3 years ago on Friday December 23, 2011 | Permalink