カスタムユーザーフィールドの作成と設定

:bookmark: このガイドでは、Discourseでカスタムユーザーフィールドを作成・設定する方法を説明します。登録フォーム、ユーザープロフィール、ユーザーディレクトリに追加する方法も含まれています。

:person_raising_hand: 必要なユーザー権限: 管理者

カスタムユーザーフィールドを使用すると、標準のプロフィール項目に加えて、ユーザーから追加情報を収集できます。これらのフィールドは、ユーザーカードやユーザー概要ページに表示でき、Data Explorerプラグインを使用して取得することもできます。このガイドでは、カスタムユーザーフィールドの作成と設定の手順を説明します。

ユーザーフィールドの追加

  1. 管理画面 > コミュニティ > ユーザーフィールド (discourse.example.com/admin/config/user-fields) に移動します。

  2. まだユーザーフィールドを作成していない場合、以下の画面が表示されます:

  3. 新しいフィールドを追加するには、「ユーザーフィールドを追加」ボタンをクリックします。

フィールドタイプの選択

フィールドタイプは、登録フォームでユーザーが見る入力フィールドを決定します。収集する情報の種類に基づいて選択してください:

テキストフィールド

  • 回答の可能性が多い短い質問に使用します(例: 「どの会社で働いていますか?」)
  • 1行のHTMLテキスト入力として表示されます

テキストエリア

  • より長く、複数行の回答が必要な質問に使用します(例: 「自己紹介をしてください」)
  • 複数行のHTMLテキストエリア入力として表示されます

日付

  • 日付値の収集に使用します(例: 「生年月日は何ですか?」)
  • 日付ピッカー入力として表示されます

確認

  • はい/いいえの質問に使用します(例: 「ニュースレターへの登録を希望しますか?」)
  • HTMLチェックボックスとして表示されます
  • HTMLを使用して、ユーザーが確認するために重要なリンクを追加できます。例:
    コミュニティガイドラインを読み、遵守することに同意します <a href="https://meta.discourse.org/guidelines">コミュニティガイドライン</a>

ドロップダウン

  • 回答の選択肢が決まっている質問に使用します(例: 「あなたの性別は何ですか?」)
  • HTMLセレクト入力として表示されます

ドロップダウンフィールドにオプションを追加するには:

  1. オプション入力欄をクリックします
  2. 回答を入力し、「作成」をクリックします
  3. 追加のオプションがある場合は繰り返します

完成したオプションは、以下のような見た目になります:

複数選択

  • 複数の回答をオプションから選択できる質問に使用します(例: 「どのトピックに興味がありますか?」)
  • 複数選択入力として表示されます
  • オプションは、ドロップダウンフィールドと同じ方法で設定します

フィールド名と説明の設定

  • フィールド名: 登録フォームとユーザープロフィールの入力欄の前に表示されます
  • フィールド説明: ユーザーがフィールドを記入するのを助けるために、入力欄の後に表示されます

:information_source: フィールド名と説明は、フィールドを保存するために両方とも必須です。

カスタムフィールドが登録フォームに表示される様子は以下の通りです:

ユーザーフィールドオプションの設定

フィールドの必須要件

  • 任意 - 任意のフィールドは、ユーザーが空欄のままにすることができます
  • 全ユーザーに必須 - フィールドが全ユーザーに必須の場合、ログイン中のユーザーを含むすべてのアカウントで、そのフィールドの入力が強制されます。利用規約(ToS)の要件などの場合に非常に有用です。
  • 登録時に必須 - すべての新規アカウントで、そのフィールドの入力が必須になります。

また、作成フォームの下部には、以下の設定チェックボックスがあります:

  • 登録後に編集可能: ユーザーがプロフィールページからフィールドを更新できるようにします
  • 公開プロフィールに表示: ユーザーの概要ページにフィールド値を表示します
  • ユーザーカードに表示: ユーザーカードにフィールド値を表示します
  • 検索可能: ユーザーディレクトリで、このフィールドの値に基づいてユーザーを検索できるようにします
  • 登録フォームに表示: フィールドが登録フォームに表示されるかを制御します。フィールドの必須要件が「全ユーザーに必須」または「登録時に必須」の場合、またはフィールドが登録後に編集できない場合は、自動的に有効になります(無効にすることはできません)。

公開プロフィールに表示

有効にすると、フィールド値がユーザーのプロフィールページに表示されます:

ユーザーカードに表示

有効にすると、フィールド値がユーザーカードに表示されます:

検索可能

有効にすると、カスタムフィールドの値に基づいてユーザーを検索できます:

フィールドの保存と編集

  1. サイトのユーザーフィールドリストにフィールドを追加するには、「保存」をクリックします
  2. フィールドを編集するには、リスト内の該当するフィールド横の「編集」ボタンをクリックします
  3. フィールドを削除するには、横の省略記号メニュー (⋮) をクリックし、「削除」を選択します

ユーザーディレクトリにカスタムフィールドの追加

  1. ユーザーディレクトリに移動します
  2. レンコンアイコンをクリックします:

  1. 表示したいカスタムユーザーフィールドにチェックを入れます
  2. 「保存」をクリックします

選択したカスタムフィールドは、ユーザーディレクトリのテーブルに表示されるようになります:

「いいね!」 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