2

User Registration Form

I want to setup a public registration form in Craft CMS. Currently this form support only fields username, email, password, but I want to add at least 10 other fields.

Also I want to create three types of user groups. How do I update the group in the public registration form?

User registration in Craft

4

Before you can allow any type of user groups you will need at a minimum of the Client version of Craft. To allow public registration, you will need the Professional version. Only the Professional version will allow you to have public registration on our site. Here is more information about users and user groups.

To add additional fields to your registration form, I would start here. That will get you started with a basic form.

You will need to create a new field within the CP. For example - let's say I want to capture your pets name.

I will create a text input, called petName. Then in the layout builder, I will assign that field to the user profile tab.

Next, I need to update my registration form with my new input.

Note: any new field you want to add to the user's profile must be prefixed with fields[]. For example:

<label for="petName">Pet Name</label>
<input type="text" id="petName" name="fields[petName]" {%- if account is defined %} value="{{ account.petName }}"{% endif %}" placeholder="">
{{ account is defined and account ? errorList(account.getErrors('petName')) }}

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.