Custom User Field inputs can be added to a site’s signup form and user profile pages. The data entered into these inputs can be displayed on user cards and on user summary pages. Custom User Fields can also be retrieved with the Data Explorer plugin. Here is how to create and configure Custom User Fields.
Adding a User Field
To create a field, go to Admin / Customize / User Fields. If you haven’t created any User Fields yet, that page will look like this:
Click the Create User Field button to add a new user field.
Field Type
The Field Type determines the type of input field a user will see on your site’s signup form. The field type you choose depends on the kind of information you are collecting.
Text Field
The Text Field field type will display as an HTML text input. Use Text Fields if you are asking a question that has a large number of possible answers. For example, ‘What company do you work at?’
Confirmation
The Confirmation field type will display as an HTML checkbox input. Select Confirmation as the field type if you are asking a question that can be answered with yes/no. For example, ‘Would you like to sign up for our newsletter?’
Dropdown
The Dropdown field type will display an HTML option input. Use Dropdown field types if the question you are asking has one of a number of possible answers. For example, ‘What is your gender?’
After selecting the Dropdown field type, an option input will be added to the User Field creation form. Click on the input to add the possible answers to your question. Type in one of the possible answers, and then click ‘Create.’ You can add as many fields as you like by repeating this step.
The completed options should look similar to this:
Field Name and Description
The Field Name will be displayed before the field input on the signup form and on the user profile page. The Field Name will also be used if the ‘show on public profile’ or ‘show on user card’ options are selected for the field. (See below for details on these options.)
The Field Description will be displayed after the field input. It is used to help the user complete the field.
The field name and description must be entered before you will be allowed to save a field.
Setting the User Field Options
At the bottom of the User Field creation form, you’ll see options to set ‘Editable after signup?’, ‘Required at signup?’, ‘Show on public profile?’, and ‘Show on user card?’
Editable after signup
By default, information can only be added to User Fields on the Discourse signup form. To allow users to set or update the field from their profile page, select the Editable after signup option.
Required at signup
By default, User Fields are optional. To require users to complete a field before creating an account, enable the ‘Required at signup’ option.
Show on public profile
To show the value of a User Field on the user’s summary page, select ‘Show on public profile.’ The value of the field will be shown next to the Field Name.
Show on user card
Select this option to show the field on the user card. The value of the field will be displayed next to the Field Name.
Saving and editing a field
Once you have entered the information required for creating a field, click the field’s Save button. The field will be added to the list of User Fields that are enabled for your site.
To edit a User Field, click the Edit button next to a field in the list. To delete a field, click the Deletebutton.