XF 2.2 Optional custom user field on registration

digitalpoint

Well-known member
Let's say I wanted to have an optional user field available when a user registers, but I don't want it editable for registered users. Specifically, my use-case is a drop-down list asking the user where they heard about the site (I don't want it required and don't want someone to be able to go in and edit it after the fact).

I was thinking the "Show during registration" option would do that, but it appears in order to make it show on registration you either need to make the field required (which I don't want to do in case they pick nothing) or you have to make it user editable (which would allow existing users to edit it on their account preferences, which I also don't want).

If I set the custom user field options to this, it does not show during registration (shouldn't it be implied that if you want to force it to show during registration, the user has permissions to edit the value during registration?).

1628792572808.png

Maybe I'm missing something, but it seems like a pretty common use case and the option to "Show during registration" implies to me that it should show during registration (which it does not).
 

digitalpoint

Well-known member
Editable only once allows it to be editable after the fact on existing user's preferences page (I don't want existing users to be able to edit it or someone to go back after registration to set it if they didn't set it during registration).
 

Ksentile

New member
Let's say I wanted to have an optional user field available when a user registers, but I don't want it editable for registered users.

My forum has exactly the same scenario, but I have also set the field hidden in the profile because it's one-time private information the users needn't to access anymore. I have the five topmost boxes selected.

I remember it was a bit of struggle to get everything working in the way I wanted, but it did turn out just great.
 

Ksentile

New member
Is there something awkward in having the field drop-down list required and having its default choice field as nothing (" ")?

Would it be easier to look into a small extra.less or template modification which hid the field if the default "nothing" was selected? I guess it's similar type of result that you are looking for after all.
 

digitalpoint

Well-known member
Ya, it could be done with modifications... just figured it would be easy to do with a custom user field. If I'm going to modify something, it's going to be the code, not the templates/CSS. I guess that's the route I will take. Still seems weird to be that you can't have an optional registration-only field though. 🤷🏻‍♂️
 
Top