# Add a plugin based custom user field to the create account form?

**URL:** https://meta.discourse.org/t/add-a-plugin-based-custom-user-field-to-the-create-account-form/141088
**Category:** Development
**Created:** [February 8, 2020, 10:45pm UTC](https://meta.discourse.org/t/add-a-plugin-based-custom-user-field-to-the-create-account-form/141088 "2020-02-08T22:45:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![davidnewkerk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidnewkerk/32/171224_2.png) [@davidnewkerk](https://meta.discourse.org/u/davidnewkerk)
#### Post date: [February 8, 2020, 10:45pm UTC](https://meta.discourse.org/t/add-a-plugin-based-custom-user-field-to-the-create-account-form/141088/1 "2020-02-08T22:45:06Z")

</div>

I’ve added a custom user field using a plugin, following the example at:

> [@Add a custom per-user setting in a plugin](https://meta.discourse.org/t/add-a-custom-per-user-setting-in-a-plugin/94048):
>
> I just went through this process and experienced a bunch of trial and error, so I thought I’d document my findings to help the next developer to come along. The things I needed: Register your custom field type (mine was boolean, default is string) # plugin.rb User.register\_custom\_field\_type 'my\_preference', :boolean Register that the custom field should be editable by users. Syntax matches that of [params.permit(...)](https://edgeapi.rubyonrails.org/classes/ActionController/Parameters.html#method-i-permit) # plugin.rb register\_editable\_user\_custom\_field :my\_preference # Scal…

This works great and the custom field appears on the user’s profile edit page, and the value can be edited and saved.

I’d like to get this field to appear as well on the create account form (app/assets/javascripts/discourse/templates/modal/create-account.hbs) the way that the UI-created custom user fields do, but am struggling to find a way to do it. If anyone knows how, or can point to any other plugins or examples that include a custom field on the registration form, that would be awesome!

Note: I’m aware that `/admin/customize/user_fields` allows the creation of custom user fields through the UI, however I discovered that the fields created in this way are internally given a generic name like `user_field_2` (for example) and for my use case I need the field to have a predetermined permanent name that my plugin code can reliably refer to.

Thanks!

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 9, 2020, 8:39am UTC](https://meta.discourse.org/t/add-a-plugin-based-custom-user-field-to-the-create-account-form/141088/2 "2020-02-09T08:39:10Z")

</div>

The [Custom Wizard Plugin 🧙](https://meta.discourse.org/t/custom-wizard-plugin/73345) allows you to prompt a user for additional information around registration. I recently employed that technique to allow users to set their National Flag when signing up which uses a Custom Field. [National Flags - #81 by merefield](https://meta.discourse.org/t/national-flags-display-user-nationality-in-discourse/55969/81)

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/a/9a5f52ba05a2fde082c2c7dbeedf2e60e999c069.png)
