# Custom User fields not saving

**URL:** https://meta.discourse.org/t/custom-user-fields-not-saving/70900
**Category:** Bug
**Created:** [September 27, 2017, 8:23pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900 "2017-09-27T20:23:34Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![soundboy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soundboy/32/79052_2.png) [@soundboy](https://meta.discourse.org/u/soundboy)
#### Post date: [September 27, 2017, 8:23pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/1 "2017-09-27T20:23:34Z")

</div>

I added several “User Fields” that users are prompted to fill out when they create the account. The accounts are created after I send an invite link to the user - they click the link, fill out the fields, and their account is created.

HOWEVER - none of those fields are getting saved. When I test this out, I fill out all the fields, hit submit, go to my profile settings, and those fields are blank.

Has anybody else experienced this? I’m holding off on launching our forum until we figure this out…

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [September 27, 2017, 8:43pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/2 "2017-09-27T20:43:24Z")

</div>

Hi Dan, can you check that you are on the absolute latest version of Discourse? We had a bug like this 2 days ago, should be resolved.

You can manually check for update by visiting `/admin/upgrade` on your site.

---

<div class="post-metadata">

### Author: ![soundboy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soundboy/32/79052_2.png) [@soundboy](https://meta.discourse.org/u/soundboy)
#### Post date: [September 29, 2017, 3:28pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/3 "2017-09-29T15:28:11Z")

</div>

Just updated to the latest version, and no dice 😕

The “Name” field saves, but none of the custom fields. Any ideas? Could you test this out on your end to confirm?

---

<div class="post-metadata">

### Author: ![soundboy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soundboy/32/79052_2.png) [@soundboy](https://meta.discourse.org/u/soundboy)
#### Post date: [October 2, 2017, 7:26pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/5 "2017-10-02T19:26:22Z")

</div>

@jomaxro any updates on this?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [October 2, 2017, 7:28pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/6 "2017-10-02T19:28:49Z")

</div>

It looks like @zogstrip was looking into this. I don’t have any updates at this time, he should be able to update you tomorrow (it’s outside of work hours already in Europe).

---

<div class="post-metadata">

### Author: ![soundboy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soundboy/32/79052_2.png) [@soundboy](https://meta.discourse.org/u/soundboy)
#### Post date: [October 2, 2017, 8:12pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/7 "2017-10-02T20:12:14Z")

</div>

Cool, thanks for the update. @zogstrip let me know what you find. Seems like it’s really easy for us to reproduce, and I’m holding off on launching our forum until this is fixed.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 3, 2017, 9:44am UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/8 "2017-10-03T09:44:13Z")

</div>

What version of Discourse are you running?

I initially thought it was related to my recent fixes regarding user options/profiles not saving but I can not reproduce your issue. User fields work just fine locally and on [try](https://try.discourse.org).

---

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [October 3, 2017, 11:38am UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/9 "2017-10-03T11:38:56Z")

</div>

I’m having a similar issue, which has been going on for some months but I’ve not previously had time to look into it.

I have some custom user fields set up via the Admin interface, however when new users sign up and complete the fields, the data entered is not retained, and the fields are blank in their profiles. I’ve also tested via the Rails console and the data isn’t being saved.

When I first set up user fields they worked fine, and I’m in the process of trying to work out exactly when it stopped working (we only started to pay more attention to the user fields recently hence we didn’t really notice previously)

I’m on Discourse v1.9.0.beta11 +11

For some users (seemingly ones that have been members for a long time) there is data under both User.user\_fields and User.custom\_fields. I’m confused as to the difference between those two models, [UserField](https://github.com/discourse/discourse/blob/c68999e1283ea7f9bc50fe6e8df3c4ddc05b7df0/app/models/user_field.rb) and [UserCustomField](https://github.com/discourse/discourse/blob/5dbd6a304bed5400be481d71061d3e3ebb4d6785/app/models/user_custom_field.rb), since for some users there is similar data in both, but for other users there’s nothing in either!

As an example, here’s a brand new user I just created. During signup I entered test data for all of the custom user fields. But following sign-up the data is all gone. from the User Profile UI, and on the Rails console:

```plaintext
pry(main)> User.where(username: 'testuser_userdata').first.custom_fields
=> {}
[6] pry(main)> User.where(username: 'testuser_userdata').first.user_fields
=> {"4"=>nil, "2"=>nil, "1"=>nil, "3"=>nil, "8"=>nil, "5"=>nil, "6"=>nil, "7"=>nil}

```

Any suggestions as to how to continue debugging this?

Marcus

---

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [October 3, 2017, 12:39pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/10 "2017-10-03T12:39:36Z")

</div>

In the error logs I can see an entry from around the time I tried to create the new test user with test custom data:

```plaintext
TypeError: Cannot call method "create" of undefined (https://forum.myforumname.net/assets/vendor-057c8aaf728aa3bc264d5ff93a70e003efe4f4ecdc16ba0a02d452e6e3ef4402.js#7)
Url: https://forum.myforumname.net/login
Line: 7
Column: 0
Window Location: https://forum.myforumname.net/login

```

---

<div class="post-metadata">

### Author: ![soundboy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soundboy/32/79052_2.png) [@soundboy](https://meta.discourse.org/u/soundboy)
#### Post date: [October 3, 2017, 3:00pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/11 "2017-10-03T15:00:26Z")

</div>

I’m using v1.9.0.beta11 +12

User fields save when I update them in the profile. They do NOT save when I create a new account from an invite link and am prompted to enter the user fields. I add all the details, save, activate the account, and then nothing is stored in the profile except for NAME.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 3, 2017, 3:12pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/12 "2017-10-03T15:12:39Z")

</div>

I (apparently) only fixed the issue when updating the user profile, not at creation time. Will fix.

---

<div class="post-metadata">

### Author: ![soundboy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soundboy/32/79052_2.png) [@soundboy](https://meta.discourse.org/u/soundboy)
#### Post date: [October 3, 2017, 3:58pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/13 "2017-10-03T15:58:52Z")

</div>

Word! Thank you so much. please let me know when it’s ready and I’ll get our forum launched 🙂

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 4, 2017, 9:05pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/14 "2017-10-04T21:05:16Z")

</div>

Ok, so this was indeed a similar yet different bug. It’s now fixed though 🍔

[https://github.com/discourse/discourse/commit/4771b0a99f5f147a7348f5dc4b4170543a9b9133](https://github.com/discourse/discourse/commit/4771b0a99f5f147a7348f5dc4b4170543a9b9133)

---

<div class="post-metadata">

### Author: ![soundboy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soundboy/32/79052_2.png) [@soundboy](https://meta.discourse.org/u/soundboy)
#### Post date: [October 4, 2017, 9:22pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/15 "2017-10-04T21:22:49Z")

</div>

@zogstrip Excellent! Do I need to update or anything or should it just be working now?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 4, 2017, 9:24pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/16 "2017-10-04T21:24:30Z")

</div>

You’ll need to update to latest to get the fix.

---

<div class="post-metadata">

### Author: ![soundboy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soundboy/32/79052_2.png) [@soundboy](https://meta.discourse.org/u/soundboy)
#### Post date: [October 4, 2017, 9:50pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/17 "2017-10-04T21:50:48Z")

</div>

I’m not seeing an available update in the Admin. Do they get released periodically or should there be one there now?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 4, 2017, 10:23pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/18 "2017-10-04T22:23:49Z")

</div>

It’s not a new version per se, so it won’t be advertised in your admin dashboard.

Rebuild your container and you’ll get the fix 😉

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [October 4, 2017, 10:25pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/19 "2017-10-04T22:25:40Z")

</div>

> [@zogstrip](#):
>
> Rebuild your container and you’ll get the fix

Alternately, visit `/admin/upgrade` to apply the update like you would when there is a new version.

---

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [October 5, 2017, 3:52pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/20 "2017-10-05T15:52:22Z")

</div>

@zogstrip thanks for the fix.

I can confirm that applying the update has fixed this issue for my forum. Newly invited members’ custom user data is being correctly saved.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 5, 2017, 3:53pm UTC](https://meta.discourse.org/t/custom-user-fields-not-saving/70900/21 "2017-10-05T15:53:56Z")

</div>


