Bug: UserField "Editable after signup" automatically forces "Show on signup"

AI-generated summary

The discussion revolves around a bug in the UserField creation process in Discourse, where the “Editable after signup” option automatically forces “Show on signup” to be checked, creating a sequence-dependent behavior. copymonopoly explains that unchecking “Show on signup” first prevents “Editable after signup” from being checked, but rechecking “Show on signup” later doesn’t allow “Editable after signup” to be unchecked again. Moin argues this is intentional to prevent fields from being neither shown nor editable on signup, but acknowledges the need for more flexibility. copymonopoly clarifies that the issue isn’t mutual exclusivity but the inability to have a field that is neither shown nor editable. Moin reiterates the logic behind the current design, while hugh requests further review from @ted.

When creating a user field (UserField) in the admin panel, there is a sequence-dependent behavior:

  1. Initial state:

    • “Show on signup” is checked by default
    • “Editable after signup” is unchecked
  2. Sequence A:

    • First uncheck “Show on signup”
    • Do not check “Editable after signup”
    • :white_check_mark: Saves successfully: the field is neither shown on the signup form nor editable after signup
  3. Sequence B:

    • First check “Editable after signup”
    • Then try to uncheck “Show on signup”
    • :cross_mark: Frontend automatically re-checks “Show on signup” when you uncheck it
2 Likes

I don’t think it’s a bug. It’s intended to work that way. But I agree it would be helpful if this was possible

1 Like

Just to clarify — the bug isn’t about these options being mutually exclusive.

The real issue is: originally, a field can have both “Editable after signup” and “Show on signup” unchecked. But once you check “Editable after signup” even once, the frontend enforces that at least one of these two options must be selected from then on.

This behavior is sequence-dependent.

3 Likes

Fields that are optional but not editable need to be on the signup form, or they can never be filled in

The goal of the current implementation was to prevent admins from creating a user field that is neither editable nor shown on sign up. So if something is a bug, then it’s that you can still create the field without these properties. I would prefer if instead of fixing that, the @team would consider the use case of staff-only user fields and fulfill that feature request. That’s why I posted in the feature topic.

3 Likes

@ted Could you have a look at this one please? IIRC you worked on this set of options recently.

2 Likes