Is there a way to allow a registrant to choose a user group in the registration form?
I tried using the following code but it didn't work:
<input type="hidden" name="userGroups" value="3">
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.Sign up to join this community
As far as I know there is no way to do this without a plugin. However, developing a plugin for this is not difficult. In your form you would want to add an additional drop-down, multi-select, or checkbox field with your groups listed. Then in your plugin, create a listener in your plugin's init method that listens for the
users.saveUser event, and dynamically assigns the user to the selected groups based on the user's selection. For an example see this post explaining how to respond to an onSaveUser event, and this post on assigning groups dynamically.