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

:bookmark: このガイドでは、Discourse でカスタムユーザーフィールドを作成および設定する方法を説明します。これには、サインアップフォーム、ユーザープロフィール、ユーザーディレクトリへの追加方法が含まれます。

:person_raising_hand: 必要なユーザーレベル: 管理者

カスタムユーザーフィールドを使用すると、標準のプロフィールフィールド以外に、ユーザーから追加情報を収集できます。これらのフィールドは、ユーザーカード、ユーザーサマリーページに表示でき、データエクスプローラープラグインを使用して取得することもできます。このガイドでは、カスタムユーザーフィールドの作成と設定の手順を説明します。

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

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

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

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

フィールドタイプの選択

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

テキストフィールド

  • 多くの回答の可能性がある短い質問に使用します(例:「どの会社にお勤めですか?」)
  • シングルラインのHTMLテキスト入力として表示されます

テキストエリア

  • より長く、複数行の回答が必要になる可能性のある質問に使用します(例:「自己紹介をしてください」)
  • 複数行のHTML textarea入力として表示されます

日付

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

確認

  • はい/いいえの質問に使用します(例:「ニュースレターに登録しますか?」)
  • HTMLチェックボックスとして表示されます

ドロップダウン

  • 一定数の可能な回答がある質問に使用します(例:「性別は?」)
  • HTML select入力として表示されます

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

  1. オプション入力欄をクリックします
  2. 回答を入力し、「作成」をクリックします
  3. 追加のオプションについては繰り返します

完成したオプションは次のように表示されます。

マルチセレクト

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

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

  • フィールド名: サインアップフォームとユーザープロフィールの入力の前に表示されます
  • フィールド説明: 入力の後ろに表示され、ユーザーがフィールドを完了するのに役立ちます

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

カスタムフィールドがサインアップフォームにどのように表示されるかを以下に示します。

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

フィールドの要件

  • 任意: 任意のフィールドはユーザーが空のままにすることができます
  • すべてのユーザーに必須: フィールドがすべてのユーザーに必須の場合、ログインしているユーザーを含むすべてのアカウントが、フィールドへの入力を強制されます。これは、利用規約(ToS)の要件などの場合に非常に役立ちます。
  • サインアップ時: すべての新規アカウントがフィールドへの入力を強制されます。

さらに、作成フォームの下部には、次の設定チェックボックスがあります。

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

公開プロフィールに表示

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

ユーザーカードに表示

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

検索可能

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

フィールドの保存と編集

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

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

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

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

選択したカスタムフィールドがユーザーディレクトリのテーブルに表示されます。

「いいね!」 39
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
Private custom user fields...?
Users self-select Category on Registration... is it possible?
Can we implement a system for user remarks during registration for admin review?
User Field Prompt
New user reviews: admin assignment and logging of progress
User customizable theme components (how-to)
Add users to groups on signup
Announcing - Gender Pronouns Userfield on Meta
Add a custom per-user setting in a plugin
Welcome questions on the first screen for bio
How to add min or max values in custom fields?
Custom user fields not available in api
Grant Custom Badge Upon Reading ToS
Required vs. optional sign-up fields
Add users to groups through custom field automation
Terms of Service Checkbox
Hidden User Fields
Social Features
Where in Discourse can users publicly share PII?
Linking "static" information about member to topic posted
Using Discourse as a social media platform
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?
This freaking software works so well I can’t even
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
Add custom fields to signup and login
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