Creating and configuring custom user fields

:bookmark: This guide explains how to create and configure custom user fields in Discourse, including how to add them to the signup form, user profiles, and user directory.

:person_raising_hand: Required user level: Administrator

Custom user fields allow you to collect additional information from your users beyond the standard profile fields. These fields can be displayed on user cards, user summary pages, and even retrieved using the Data Explorer plugin. This guide will walk you through the process of creating and configuring custom user fields.

Adding a user field

  1. Go to Admin > Community > User Fields (discourse.example.com/admin/customize/user_fields).

  2. If you haven’t created any user fields yet, you’ll see this screen:

  3. Click the “Create User Field” button to add a new field.

Choosing a field type

The field type determines the input field users will see on the signup form. Choose based on the kind of information you’re collecting:

Text field

  • Use for questions with many possible answers (e.g., “What company do you work for?”)
  • Displays as an HTML text input
    User text field

Confirmation

  • Use for yes/no questions (e.g., “Would you like to sign up for our newsletter?”)
  • Displays as an HTML checkbox
    User confirmation field

Dropdown

  • Use for questions with a set number of possible answers (e.g., “What is your gender?”)
  • Displays as an HTML select input
    Dropdown user field

To add options for a dropdown field:

  1. Click on the option input
  2. Type an answer and click “Create”
  3. Repeat for additional options
    Dropdown user field option creation

The completed options should look similar to this:

Dropdown user field options

Setting the field name and description

  • Field Name: Appears before the input on the signup form and user profile
  • Field Description: Appears after the input to help users complete the field

:information_source: Both the field name and description are required to save a field.

Here’s how custom fields appear on the signup form:

Configuring user field options

Field Requirements

  • Optional - Optional fields may be left empty by users
  • For all users - When a field is required by all users, every account, including logged on users will be forced to fill it. This is very useful for cases such as a terms-of-service (ToS) requirement.
  • On signup - All new account will be required to fill the field.

Additionally, at the bottom of the creation form, you’ll find these options:

  • Editable after signup: Allows users to update the field from their profile page
  • Required at signup: Makes the field mandatory during account creation
  • Show on public profile: Displays the field value on the user’s summary page
  • Show on user card: Shows the field value on the user card
  • Searchable: Enables searching for users based on this field’s value in the user directory

Show on public profile

When enabled, the field value will be shown on the user’s profile page:

User profile custom field

Show on user card

When enabled, the field value will be displayed on the user card:

User card custom field

Searchable

When enabled, you can search for users based on their custom field values:

Saving and editing fields

  1. Click “Save” to add the field to your site’s list of user fields
  2. To edit a field, click the “Edit” button next to it in the list
  3. To delete a field, click the “Delete” button

Adding custom fields to the user directory

  1. Go to the user directory
  2. Click the wrench icon:

  1. Check the custom user fields you want to display
  2. Click “Save”

The selected custom fields will now appear in the user directory table:

Last edited by @sam 2024-08-27T04:37:50Z

Last checked by @hugh 2024-08-27T04:45:20Z

Check documentPerform check on document:
37 Likes

I think two images are missing under these headings:

Not sure if it’s related to Missing images at Meta.discourse.org – will post there too.

I can see those images? (also in an anon window)

1 Like

I cannot see theose

But the second one works in my quote.

Edit

1 Like

Interestingly I can see the second picture in the quote, but not in the original post^^

1 Like

Hmm. That’s interesting. I think there is a fix coming for the Missing images at Meta.discourse.org issue, so hopefully it will be resolved by that. :crossed_fingers:

2 Likes

Is there a setting I have to modify to specify the maximum length of a custom user field? Right now, in this “Test” field that I created as a test user field, I cannot enter even a single character on my user profile (or even “Test”, as shown).

I would love a field type: link / URL is that possible?

As URLs are text, the text field technically works, @Vaping_Community. However, you may be asking for additional details such as value validation or similar.

You might search or create a feature topic with what you have in mind. :slight_smile:

3 Likes