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

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).
 
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).
 
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.
 
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.
 
We use the https://xenforo.com/community/resources/custom-fields-permissions.6108/ add-on to tweak permissions for viewing and so forth on a custom field to do exactly this. So registration has a "optional notes" type box for people to say why they want an account (bots obviously don't bother or write nonsensical stuff). That field we see in the registration signups (as another useful spam data point), but users don't see it as an editable field in their accounts or profiles or anywhere else.

So in our case we have it "User editable" + "Editable only once" + "Show during registration". Then we prevent it from being viewed in profiles and so forth using the above add-on, and only allow users to write to the field prior to their registration being accepted. That's all based on group membership.

It's a good add-on we use it extensively.
 
Back
Top Bottom