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

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

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!

2 Likes

The Custom Wizard Plugin 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 - Display user nationality in Discourse

image

2 Likes