Custom User fields not saving

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…

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.

4 Likes

Just updated to the latest version, and no dice :confused:

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

@jomaxro any updates on this?

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

1 Like

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.

1 Like

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.

3 Likes

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 and UserCustomField, 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:

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

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:

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

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.

1 Like

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

2 Likes

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

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

https://github.com/discourse/discourse/commit/4771b0a99f5f147a7348f5dc4b4170543a9b9133

3 Likes

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

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

2 Likes

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

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 :wink:

3 Likes

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

4 Likes

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

6 Likes