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/config/user-fields).

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

  3. Click the “Add 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 short questions with many possible answers (e.g., “What company do you work for?”)
  • Displays as a single-line HTML text input

Textarea

  • Use for questions that may require longer, multi-line answers (e.g., “Tell us about yourself”)
  • Displays as a multi-line HTML textarea input

Date

  • Use for collecting date values (e.g., “What is your date of birth?”)
  • Displays as a date picker input

Confirmation

Dropdown

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

The completed options should look similar to this:

Multiselect

  • Use for questions where users can choose multiple answers from a set of options (e.g., “Which topics interest you?”)
  • Displays as a multi-select input
  • Options are configured the same way as dropdown fields

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 preference checkboxes:

  • Editable after signup: Allows users to update the field from their profile page
  • 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 signup form: Controls whether the field appears on the signup form. This is automatically enabled (and cannot be disabled) when the field requirement is “For all users” or “On signup”, or when the field is not editable after signup.

Show on public profile

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

Show on user card

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

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 ellipsis menu (⋮) next to it and select “Delete”

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 @fzngagan 2025-07-17T09:12:38Z

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

Check documentPerform check on document:
40개의 좋아요
Any Plugins/Easy Mods for an Extended User Profile
Add introductory text for sign-up
Setting Security Parameters: Log-In, Read-Only, Protected Groups
Theme-Component v Plugin: What's the difference
User preference on theme components
Users self-select Category on Registration... is it possible?
Private custom user fields...?
Can we implement a system for user remarks during registration for admin review?
User customizable theme components (how-to)
This freaking software works so well I can’t even
User Field Prompt
New user reviews: admin assignment and logging of progress
Add users to groups on signup
How to add min or max values in custom fields?
Add a custom per-user setting in a plugin
Welcome questions on the first screen for bio
Announcing - Gender Pronouns Userfield on Meta
Grant Custom Badge Upon Reading ToS
If topic info is too long, tags are cut off and create a blank line
Required vs. optional sign-up fields
Terms of Service Checkbox
Hidden User Fields
New user filter by custom field and contact
Social Features
Where in Discourse can users publicly share PII?
Linking "static" information about member to topic posted
Add custom fields to signup and login
Using Discourse as a social media platform
Add users to groups through custom field automation
Custom user post display
Disable account confirm emails when creating users via API
Links in additional fields
Clickable Social Icon Links on Profile
Extend Existing Controller?
Requiring acceptance of terms and conditions
"Fake" OAuth Provider?
Extend Existing Controller?
Allow users to block keywords
Customize Your Site Branding
Restrict the users to post in the groups who haven't uploaded their profile picture
Adding non-visible user custom fields to the API
Seeking Advice: making a discourse forum hyper local
Can add short message to verify? Just input phone number can sign up
Add terms when make new topic
Export custom field for users in discourse hosted forum
Customizing Sign-up and Log in
Grouping poll results by user custom field
Disclaimer for tutorials
How to add custom logic input on the signup page?
Terms of service changes in Discourse platform
Custom user fields not available in api

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개의 좋아요

I cannot see theose

But the second one works in my quote.

Edit

1개의 좋아요

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

1개의 좋아요

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개의 좋아요

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?

URL은 텍스트이므로, @Vaping_Community 님, 기술적으로 텍스트 필드가 작동합니다. 다만, 값 검증이나 유사한 추가 세부 사항이 필요하신 것일 수도 있습니다.

Contribute > Feature 토픽에서 구상하신 내용을 검색하거나 생성해 보시기 바랍니다. :slight_smile:

3개의 좋아요

커스텀 사용자 필드에 대해 여러 줄/컴포저를 허용할 계획이 있나요? :folded_hands:

사용자 정의 필드에 링크를 삽입하려면 HTML 구문을 사용해야 합니다!
<a href="url">링크 텍스트</a>

예를 들어, 커뮤니티 가이드라인/정책을 확인했음을 알리려면:

1개의 좋아요

Auth0 SSO의 사용자 정의 클레임(custom claim)을 사용자 정의 필드에 연결할 수 있을까요? 현재 사용자는 Auth0에서 필드 정보를 입력한 후, 가입 시에도 다시 한 번 입력해야 합니다. 가능하다면 해당 값이 매핑되도록 설정하고 싶습니다.

네, 가능합니다:

SSO 엔드포인트 내에서 클레임을 페이로드에 매핑할 수 있습니다. 예를 들어:

const ssoPayload = {
  nonce: nonce,
  email: user.email,
  external_id: user.sub,
  username: user.nickname,
  name: user.name,
  add_groups: a_custom_group,
  'custom.user_field_1': user['https://yourdomain.com/company_id'],
  'custom.user_field_2':  [etc...]
3개의 좋아요

고맙습니다 @dax

db에서 필드 이름을 확인할 수 있는 방법이 있을까요? 예를 들어, 이름(first name) 필드가 있는데 custom.firstname, custom.first_name, custom.firstName을 시도해 보았지만, 가입 화면에 필드가 채워지지 않았습니다.

위와 같이 토큰 필드가 들어오고 있는지 확인하기 위해 에러 로그를 확인했습니다.

여기서 코드를 더 자세히 살펴보면, 이것은 Discourse Connect SSO에만 해당하나요? 저희는 Auth0 플러그인을 사용하고 있습니다.

구문은 custom.user_field_x여야 하며, 여기서 x/admin/config/user-fields/{x}/edit에 표시된 숫자 필드 ID입니다.

해당 매핑 기능은 Auth0 플러그인에서 직접 사용할 수 없습니다.

그럼에도 불구하고, 귀하가 설명하신 내용을 달성할 수 있는 몇 가지 옵션이 있습니다:

  • 테마 컴포넌트 생성. 이미 Auth0에 저장된 값과 Discourse 사용자 정의 사용자 필드를 자동으로 동기화하는 작은 프론트엔드 스크립트를 추가할 수 있습니다. 예를 들어, 사용자가 로그인하고 해당 필드가 비어 있는 경우, 스크립트가 보안 엔드포인트(작은 클라우드 함수)를 호출하여 Auth0에서 필드 값을 가져오고 API를 통해 Discourse 프로필을 업데이트할 수 있습니다.
  • 자동화 도구 사용. Discourse 외부에서 해당 동기화를 수행하기 위해 Zapier나 Make와 같은 외부 자동화 서비스를 사용할 수도 있습니다. 이 방식의 장점은 코드를 작성하거나 유지보수할 필요가 없고 제3자 서비스에 대한 비용만 지불하면 된다는 것입니다.
  • 맞춤형 개발. Auth0 플러그인 자체를 확장하여 로그인 시 사용자 정의 클레임을 사용자 필드로 네이티브 매핑을 지원하도록 하거나, Auth0 플러그인과 함께 작동하는 맞춤형 플러그인을 구축할 수 있습니다.

테마 컴포넌트 방식의 명확한 단점은 사용자 정의 코드를 직접 작성하고 유지보수해야 하며, 잠재적인 버그나 취약점을 도입하지 않도록 보안 측면에서도 주의를 기울여야 한다는 점입니다. 솔직히 말하면, 귀하와 같은 프로덕션 사이트에는 권장하지 않는 솔루션입니다.

저라면 두 번째 옵션인 제3자 도구 사용, 또는 Auth0 플러그인 자체를 강화하기 위한 기능 요청 또는 맞춤형 작업 요청(프로젝트 매니저들의 평가에 따라)을 고려하는 쪽에 더 무게를 둘 것입니다.

마지막 옵션에 관심이 있으시다면, 비공개로 대화를 이어나갈 수 있습니다.

1개의 좋아요

긴 사용자 필드 목록을 작은 화살표를 하나씩 클릭해서 한 단계씩 위나 아래로 이동시키는 것보다 더 간편한 재배열 방법이 있는지 궁금합니다… :face_with_peeking_eye:

사용자 필드 목록 개요에서 가입 양식에 있는 필수 필드(예: Je suis… Pays)와 선택 필드(예: Mes attentes)를 어떻게 구분하는지 확인이 안 됩니다. 제가 뭘 놓치고 있는 건지, 아니면 이 부분이 누락된 건지 궁금합니다. 선택 필드인지 확인하려면 필드를 편집해야 하니 상당히 번거롭습니다. (이것이 적절한 장소인지 확실하지 않아서 어디에 올려야 할지 몰랐습니다.)

데이터를 제공하는 JSON 파일이 조금이나마 도움이 될 수 있을 것 같습니다. 완벽하진 않지만 /admin/config/user-fields.json 파일을 확인하면 다음과 같은 내용을 볼 수 있습니다.

    {
      "id": 18,
      "name": "Age",
      "description": "How old are you?",
      "field_type": "text",
      "editable": true,
      "required": false,
      "requirement": "optional",
      "show_on_profile": false,
      "show_on_user_card": false,
      "show_on_signup": false,
      "searchable": false,
      "position": 9
    },
    {
      "id": 17,
      "name": "pets",
      "description": "choose your favourite",
      "field_type": "dropdown",
      "editable": true,
      "required": false,
      "requirement": "optional",
      "show_on_profile": false,
      "show_on_user_card": false,
      "show_on_signup": false,
      "searchable": false,
      "position": 10,
      "options": [
        "cat",
        "mouse",
        "dog"
      ]
    },

물론 인터페이스에 표시되는 정보만큼 보기 좋지는 않습니다.

1개의 좋아요

아, 그건 정말로 훨씬 다루기 편하네요!
그럼 그 파일만 수정하면 끝나는 건가요? 제 서버 어딘가에 실제로 그런 파일이 있나요? 어디서 찾을 수 있을까요? :heart_eyes::heart_eyes::heart_eyes: