Custom User Field Enhancements

As part of our work on Discourse 1.4 I spent some time enhancing user fields:


One of our most requested featured for user fields was dropdowns, so now you can add them. The options can even be dragged and dropped for reordering!

Field ordering

For some users it was very important to display the fields in a particular order. In the latest Discourse builds, you can reorder the fields. Just use the up and down arrow buttons, and the fields will be displayed in the same order when the user signs up.


This is exciting! Is it safe to assume that changing order of fields does not change their ID/names in the DB?


Yes, there is a new position column that handles the sort order.


Doesn’t seem actually working (In v1.4.0.beta8 +9). In the actual login dialog, users only see “Pick an option”, twice (see snapshot below). For required fields, they see no options instead.

Are there any plans to have a field that is a URL? We ask our users to share GitHub and SO profiles and would love those to be real links.


We’re looking for this too. In our case though it’s for users to include their social profiles.

For URLs to work well however and not be abused, we really need to be able to specify a prefix so as to lock down the domain and have them just specify a username. Otherwise they could put any link in there.

Is this something you’re already considering @eviltrout?


This is not something we are considering at this time. People can add URLs via the “About Me” field, and we have significant protection in that field.

1 Like

@steve_pd Yes, this would be perfect. We’d love to add social media too and saying what the domain would be (or even having that part non-editable) would be a fantastic solution. That would take care of having to moderate these closely as well.

@codinghorror - people in our community simply do not offer that information without prompting. Since adding those custom fields we have a lot more ‘opt-in’ to sharing those profiles. I very much hope you’ll reconsider this.


I love these changes @eviltrout - thanks for paying attention to custom user fields which can be massively useful.

A feature request: would it be possible to set a user field to be used for the user’s title? I’d like to fill it with the name of the user’s affiliated organization as a link to their organization profile, as populated via SSO.

I can see others using it similarly to display some useful bit of info on user cards and profiles that is otherwise not standard in discourse.


I think it would be more useful for you have the SSO payload specify the title. Which might already be available?

1 Like

@eviltrout Sorry to insist, but did you notice my bug report? Am I the only one seeing this bug? This feature will be very important for me in a couple of months — we plan to use it to schedule ~500 first-year students (we plan to use Discourse as the course forum, and to have them register on Discourse to also access other services).

Is this a locale specific bug? Does it work when locale is set to English ?

That forum is mostly in German, but: that screenshot was after setting the locale back to English, and I think also fields created after switching locale are affected (I might have to recheck). The forum was also first created with an English locale.

Since (I’m guessing) the feature works for you, I’ll try to dig deeper.

Besides selects, I think a repeatable field would be useful. Think like „social networks”: add facebook, add twitter, add whatever. It makes little sense to have a list of 50 social networks (i exaggerate, obviously!) fields into profile page (and on signup page).

On the other hand, this will make a bit harder badge assignment for filling a certain field, no?

We just found another (tiny) bug related to dropdowns. When changing the position of a dropdown field all the options were cleared.

Here is the PR suggesting a fix


The bug is not locale specific and occurs when the field name contains special character:

Special characters that do work are german umlauts, comma, dot and space.

Special characters that do not work are parenthesis (i.e. “(” and “)”)!

EDIT Sorry, not sure what is going on. Parens seem also to work on my test-instance.

We fail to reproduce the bug in a fresh test-instance, running on the same commit as @blaisorblade’s instance that keeps showing the problem.

I’m working with @bstudios and @Blaisorblade. We reproduced the bug by enabling login required. Then, the data about dropdown user field options is not preloaded when nobody is logged in. For example, when registering …

Maybe the guardian ate the options?


I prepared a fix to this bug in:

Since this might be a security concern and I am limited in my knowledge of the guardian, I think it is important that some knowledgable people review the change carefully.

EDIT The fix now has been merged.



Great feature! I’ve noticed that the position field only applies to the sign-up page, but not the /users/{username}/preferences page. Is there any way to have the position field respected on that page, too? As it is, it seems that the position of the custom field on /users/{username}/preferences is a function of the order in which the custom fields were created. Does that sound right?



I’ve fixed this: