# Custom User Field Enhancements

**URL:** https://meta.discourse.org/t/custom-user-field-enhancements/31572
**Category:** Feature
**Tags:** feedback
**Created:** [30 juli 2015 om 18:59 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572 "2015-07-30T18:59:27Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [30 juli 2015 om 18:59 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/1 "2015-07-30T18:59:27Z")

</div>

As part of our work on [Discourse 1.4](https://meta.discourse.org/t/discourse-version-1-4/26488) I spent some time enhancing user fields:

### Dropdowns

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!

![](https://global.discourse-cdn.com/meta/original/3X/3/f/3f05cda3e7d7abbd6f5e76efb5af71ec57f54c67.png)

### 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.

![](https://global.discourse-cdn.com/meta/original/3X/3/1/313ae4c39c6404ca34545ec2d0e7519ba7e928be.png)

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [31 juli 2015 om 16:56 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/2 "2015-07-31T16:56:34Z")

</div>

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

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [31 juli 2015 om 17:16 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/3 "2015-07-31T17:16:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Blaisorblade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blaisorblade/32/107357_2.png) [@Blaisorblade](https://meta.discourse.org/u/Blaisorblade)
#### Post date: [12 augustus 2015 om 16:20 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/4 "2015-08-12T16:20:59Z")

</div>

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.

 ![](https://global.discourse-cdn.com/meta/original/3X/8/4/840743d9342fbbc1e9fcc3bd22f4b5591bc66130.png)

---

<div class="post-metadata">

### Author: ![lisajill](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lisajill/32/32289_2.png) [@lisajill](https://meta.discourse.org/u/lisajill)
#### Post date: [12 augustus 2015 om 17:12 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/5 "2015-08-12T17:12:38Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [13 augustus 2015 om 07:17 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/6 "2015-08-13T07:17:00Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [13 augustus 2015 om 07:19 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/7 "2015-08-13T07:19:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lisajill](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lisajill/32/32289_2.png) [@lisajill](https://meta.discourse.org/u/lisajill)
#### Post date: [13 augustus 2015 om 14:11 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/8 "2015-08-13T14:11:34Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [13 augustus 2015 om 14:45 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/9 "2015-08-13T14:45:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [13 augustus 2015 om 16:21 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/10 "2015-08-13T16:21:24Z")

</div>

> [@tobiaseigen](#):
>
> 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 think it would be more useful for you have the SSO payload specify the title. Which might already be available?

---

<div class="post-metadata">

### Author: ![Blaisorblade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blaisorblade/32/107357_2.png) [@Blaisorblade](https://meta.discourse.org/u/Blaisorblade)
#### Post date: [14 augustus 2015 om 14:28 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/12 "2015-08-14T14:28:10Z")

</div>

@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).

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [15 augustus 2015 om 04:56 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/13 "2015-08-15T04:56:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Blaisorblade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blaisorblade/32/107357_2.png) [@Blaisorblade](https://meta.discourse.org/u/Blaisorblade)
#### Post date: [17 augustus 2015 om 15:44 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/14 "2015-08-17T15:44:01Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [17 augustus 2015 om 16:23 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/15 "2015-08-17T16:23:52Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![bstudios](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bstudios/32/44931_2.png) [@bstudios](https://meta.discourse.org/u/bstudios)
#### Post date: [17 augustus 2015 om 17:16 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/16 "2015-08-17T17:16:03Z")

</div>

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 [Preserve user-field options when updating user-fields by b-studios · Pull Request #3661 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/3661)

---

<div class="post-metadata">

### Author: ![bstudios](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bstudios/32/44931_2.png) [@bstudios](https://meta.discourse.org/u/bstudios)
#### Post date: [17 augustus 2015 om 17:39 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/17 "2015-08-17T17:39:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Toxaris](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/toxaris/32/116578_2.png) [@Toxaris](https://meta.discourse.org/u/Toxaris)
#### Post date: [17 augustus 2015 om 18:51 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/18 "2015-08-17T18:51:19Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![bstudios](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bstudios/32/44931_2.png) [@bstudios](https://meta.discourse.org/u/bstudios)
#### Post date: [17 augustus 2015 om 19:51 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/19 "2015-08-17T19:51:45Z")

</div>

I prepared a fix to this bug in: [Use userfield serializer in json dump by b-studios · Pull Request #3662 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/3662)

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.

---

<div class="post-metadata">

### Author: ![danfowler](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danfowler/32/116587_2.png) [@danfowler](https://meta.discourse.org/u/danfowler)
#### Post date: [19 augustus 2015 om 08:36 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/20 "2015-08-19T08:36:39Z")

</div>

Hello,

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?

Cheers,

Dan

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [21 augustus 2015 om 17:07 UTC](https://meta.discourse.org/t/custom-user-field-enhancements/31572/21 "2015-08-21T17:07:09Z")

</div>

I’ve fixed this:

[https://github.com/discourse/discourse/commit/4f8542008832da7f9138020c4c92e31963557b42](https://github.com/discourse/discourse/commit/4f8542008832da7f9138020c4c92e31963557b42)

[Volgende pagina](https://meta.discourse.org/t/custom-user-field-enhancements/31572.md?page=2)
