Review main Abandoned

84441[FEATURE] Add a gender field for FE users

Oliver Klee CR 0 V 0 Normal +136 −1 updated 08/25/24, 10:10

Commit message

Some applications like accounting systems, shops or
CRMs require users/customers to have a gender field.
So, in cases where TYPO3 needs to write users/customers
into these applications using an API, TYPO3 FE users
need to have a gender field.

Usually, it lies in the responsibility of the corresponding
TYPO3 extension to provide this field.

With basic customer/user data like name or gender, the case
is a bit different: In these cases, the responsibilities
that touch those fields often are spread out across
multiple extensions:

- providing the field in the TCA ("providers")
- allowing users to self-register and provide their data
- reading the data from the FE users table and either
  transmitting it to some API, or using it within the
  extension, e.g., for FE output or for CSV export
  ("consumers")

In the past, different extensions that provided the gender
field assigned different meanings to the values (which are
0, 1, 2, 3, and 99).

For example, if a site were to switch from one
self-registration extension to another, existing FE users
with a female gender suddenly were displayed as being of
male gender, and users having a diverse gender would be
displayed as female now.

In addition, "consumers" extensions could only work with
subset of available self-registration extensions if the
genders should not be mixed up.

To ensure interoperability for the future, the TYPO3 Core
now provides the gender field with the following string
values:

An empty string is used as the default value with
the meaning of "no gender provided", and the values
"d", "f" and "m" are used for provided gender values.

These values ensure the following properties:

- discrete, machine-readable values that can be used
  for API accesses or as keys for translations
- no overlap with the old values, allowing upgrade wizards
  to determine whether a FE user record has been migrated
- the default value of the corresponding type (string)
  means "no gender provided"

It should also be noted that the gender field is not the
same as a free-text field for the salutation (even if
some applications derive a salutation from the gender).

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 8

Review log 4046

Show 1721 earlier messages
  1. Oliver Klee uploaded patch set 1 05/28/24, 15:00

  2. Oliver Klee uploaded patch set 2 05/28/24, 15:00

  3. core-ci voted on patch set 1 V -1 05/28/24, 15:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58407

  4. core-ci voted on patch set 2 V -1 05/28/24, 15:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58408

  5. Georg Ringer commented on patch set 2 05/28/24, 15:18

    IMO it must be male/female and not mr/mrs and please stick with values like 0,1,2 as every other field as well. extensions can provide upgrade wizards - no need to have random/strange ids for ever in the core also a rst is missing
  6. Garvin Hicking commented on patch set 2 05/28/24, 17:32

    ext_tables.sql:33

    Couldn't we use "default 0" and use "0" for "not provided"? Existing entries in fe_users would receive "0" automatically via the schema migration...?
  7. Oliver Klee commented on patch set 2 CR -1 05/28/24, 20:32

    I'll discuss possible other approaches with Stefan (Busemann).
  8. Oliver Klee commented on patch set 2 05/29/24, 14:29

    Reply

    I've changed it the labels to "male" and "female" now. I cannot use the value 0,1,2,3 here as 0,1,2,99 are the values from the other extensions (with 0 meaning either "male" or "no gender provided"), and using the same values would make it impossible for upgrade wizards to recognize whether a record has already been migrated. (And as there might be multiple extensions providing the gender field installed in parallel, there might also be multiple upgrade wizards that must not migrate the same record multiple twice in order to avoid unwanted gender changes.)

    ext_tables.sql:33 Reply

    I cannot use the value 0,1,2,3 here as 0,1,2,99 are the values from the other extensions (with 0 meaning either "male" or "no gender provided"), and using the same values would make it impossible for upgrade wizards to recognize whether a record has already been migrated. (And as there might be multiple extensions providing the gender field installed in parallel, there might also be multiple upgrade wizards that must not migrate the same record multiple twice in order to avoid unwanted gender changes.) I'll switch to string values now to have a "more default-looking" default value while still avoiding the problem of possible conflicting migrations.
  9. Oliver Klee uploaded patch set 3 CR -1 V -1 05/29/24, 14:44

  10. core-ci voted on patch set 3 V +1 05/29/24, 14:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58449

  11. Benjamin Franzke commented on patch set 3 CR -2 05/31/24, 06:14

    I think this topic is way too opinionated, let's keep out of that discussion and not pre-define this field, forms just shouldn't ask for gender, done.

    fe_users.php:104

    Ordering diverse to the first position is wrong IMO. It would be the rarely used option.
  12. Mathias Brodala commented on patch set 3 05/31/24, 06:53

    fe_users.php:104 Reply

    Strictly speaking "diverse" would be the correct option for anyone on the planet. But if this is added at all, it should not provide any selection at all, since all options are wrong to someone. It should instead be a plain "input" field.
  13. Oliver Klee uploaded patch set 4 V +1 06/03/24, 08:12

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  14. core-ci voted on patch set 4 V +1 06/03/24, 08:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58611

  15. Stefan Busemann commented on patch set 4 06/03/24, 08:30

    Reply

    In general I am in favor for this change. Maybe we find an option to allow an ordering of these items?
    Add two comments

    fe_users.php:104 Reply

    lets order it f, m, d
  16. Benni Mack commented on patch set 4 06/03/24, 08:32

    I wonder if a "gender" field is actual necessary, or a "salutation" field is the actual use-case when talking . In most of my real-life projects, the most important thing was how to "talk" to users, not what gender they have.
  17. Oliver Klee commented on patch set 4 06/03/24, 08:35

    fe_users.php:104 Reply

    Done
  18. Mathias Brodala commented on patch set 4 06/03/24, 09:37

    Reply

    Agreed, that's why we should not put too much emphasis/work/time into this. Have an input field which should serve all purposes. Everything else will be wrong to someone. Also contrary to what the commit message says a migration is perfectly fine when switching from an int-select to a varchar-input since the schema change is losless and a wizard will work just fine.
  19. Stefan Busemann voted on patch set 4 CR +1 V +1 06/03/24, 10:22

  20. Oliver Klee commented on patch set 4 06/03/24, 14:34

    Reply

    I have now switched the ordering to -/f/m/d. If we want to make this configurable, I suggest we do that in a separate change.
  21. Oliver Klee updated the commit message in patch set 5 CR +1 V +1 06/03/24, 17:11

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  1. Oliver Klee commented on patch set 5 06/03/24, 17:13

    I have updated the commit message accordingly. I hope that this makes it more clear why this change is helpful.
  2. Oliver Klee commented on patch set 5 06/03/24, 17:13

    Reply

    I have updated the commit message to explain this hopefully more clearly.
  3. core-ci voted on patch set 5 V +1 06/03/24, 17:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58624

  4. Garvin Hicking uploaded patch set 6 V +1 06/03/24, 18:37

    Minor spelling changes Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  5. Garvin Hicking commented on patch set 6 CR +1 V +1 06/03/24, 18:44

    With Oliver's rewording of the "mission statement" I think this addresses a valid concern, and I can better understand the need for this. Even though the projects I've personally been involved in have successfully bypassed specifying the "gender" property at all (by using neutral salutations); BUT: with the use case of multiple existing and well-used extensions, having a core-provided field to unify behaviour and provide better interoperability between those extensions would be a net win to me.
  6. Stefan Busemann voted on patch set 6 CR +1 V +1 06/03/24, 18:48

  7. core-ci voted on patch set 6 V +1 06/03/24, 19:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58633

  8. Benjamin Franzke commented on patch set 6 CR -2 06/04/24, 07:09

    Reply

    I agree, this should not be a `gender` field but a plain input-textfield `saltuation`.
  9. Oliver Klee commented on patch set 6 06/04/24, 07:51

    Reply

    I'd indeed welcome a `salutation` field, and I see it usefulness! (And I'd be more than willing to review a change for this. Please ping me if/when you create such a change.) However, that's a different field that solves a different usecase and that does not solve the technical problems this change addresses. To be honest, I don't fully grasp your concerns about this change yet, and would like to understand them. To continue in a constructive way, I suggest we we meet in a call to find out what your specific concerns for this change are, and how we can solve them while also solving the technical problems that this change solves. (And if you're not open to investing the time to talk this over (which would be completely find with me), I'd kindly ask you to remove your -2 so we can move things forward here.)
  10. Stefan Busemann commented on patch set 6 06/04/24, 08:04

    Reply

    Sorry I think a salutation field (input) is not useful. If you want to process data automatically (f.e. build a salutation), then you need data in structured way. Therefor gender is the basis to build a salutation and further actions
  11. Benjamin Franzke commented on patch set 6 CR -1 06/04/24, 08:17

    Reply

    IMO you do not need to build a salutation if you have a salutation field. We can not define a structure where realty shows there is no world-wide consensus, see https://en.wikipedia.org/wiki/List_of_gender_identities So, please here the feedback from Benni, Mathias and me. I'm fine to remove my -2 vote (as salutation would be fine), but it stays a -1 with the current approach. I've no time nor interest in a call, I want this to be discussed in written form in public for everyone to be comprehensible.
  12. Mathias Brodala commented on patch set 6 06/04/24, 08:20

    Reply

    But this doesn't make sense. The salutation has nothing to do with the gender, so deriving a salutation from the gender is not possible. These are two different topics which are only mixed up for historical reasons. As said, a plain input field for free input makes the most sense from a user POV to not be limited to fixed options. Of course, this input can then not be used easily for interoperability. But then again the requirement to specify a gender is questionable in the first place.
    BTW, was the use case "multi-gender" also taken into account here?
  13. Oliver Klee commented on patch set 6 06/04/24, 11:01

    Reply

    Important question! No, not yet. I'd like to make sure I understand your question correctly: Are you referring to users having multiple genders at the same time, or are you suggesting adding another gender option? In case it's the latter: The current selection of gender options is the superset of the following widely-used extensions: - sr_feuser_register - femanager - sf_register - feuserextrafields So the current gender options solve the technical problem of ensuring future interoperability between these extensions (and also with "consuming" extension. I'd like to use this for starters. If we find that common real-world use case need additional values, I'd like to add those later when we need them.
  14. Mathias Brodala commented on patch set 6 06/04/24, 11:06

    Reply

    Yes, I mean users having multiple genders and thus requiring according form fields to have that reflected in TYPO3, too. Thus a single select would not suffice for this case. I cannot make a statement if a single option "multiple" or similar would suffice here.
  15. Georg Ringer commented on patch set 6 06/04/24, 11:55

    I understand both worlds Even though it doesn't make sense to have something like first/last name because there are usecases where one of those is missing there is also a large list of possible identities. On the other hand I also understand that there is a need from customers and extension authors to add one of the last missing fields. Same also for addresses. zip, city, street fits very very well in DACH area but in other parts of the world it doesn't work like that. And I doubt we will remove the fields in the core However, I suggest a solution: We could provide a oneliner extension which modifies the TCA and changes it to an input field.
  16. Stefan Busemann commented on patch set 6 06/04/24, 13:15

    Reply

    A plain input field leads to nothing. If we go back to start and look, what problem is to be solved, then we see, that we want to provide a basis for different user registration extensions. The data need to be in a structured way. Having the four suggested options covers the current "normal" cases and is a pragmatic suggestion.
  17. Georg Ringer commented on patch set 6 06/04/24, 20:14

    Reply

    @stefan.busemann@in2code.de true but you shouldn't ignore the fact that the pragmatic solution is not always the correct one ;)
  18. Oliver Klee commented on patch set 6 07/16/24, 08:22

    Everybody, please let's get this merged. The goal of this change is to allow integrators to switch from one FE user self-registration extension to another without data loss or data corruption in the gender field for already created FE user records. This is done by enforcing which values in the DB mean which gender from TYPO3 V13 on. The existing extensions (femanager, sr_feuser_register, sf_register) are widely-used. Having a single gender for users has worked well with these extensions, and the superset of the selectable values from these extensions covers the real-world use cases of these extensions. These extensions have been in use more then a decade (femanager, sf_register) or almost two decades (sr_feuser_register). Integrators that need more possible values can extend the TCA as needed via overrides. Please also note that this is about the gender field, not about the salutation field, which is a separate thing and which should not be mixed.
  19. Oliver Klee commented on patch set 6 07/16/24, 08:23

    Reply

    Acknowledged

    Reply

    Done
  20. Benjamin Franzke commented on patch set 6 CR -2 07/16/24, 08:34

    Reply

    This is not resolved.

    Reply

  21. Oliver Klee commented on patch set 6 07/16/24, 10:13

    Reply

    Okay, then I'll reply here as well. I hope that this helps. If you would like more explanations to understand the problem that is to be solved, please let me know, @ben@bnf.dev, and I'll do my best to answer your questions in order to get this change forward. > I wonder if a "gender" field is actual necessary, or a "salutation" field is the actual use-case when talking. No, we're not talking about a salutation field (even though gender and salutation are slightly related concepts). The problem to solve with this change is that the three big FE user self-registration extensions (sr_feuser_register, sf_register and femanager) all define the "gender" field, but assign different meanings to the integer values of that field. This leads to data corruption (existing FE users getting a gender change) when a site switches from on of these extensions to another. (Another, smaller problem that this change solves is that some of these extensions set the gender to "male" as default or if the gender field is not set in the FE form.) This change enforces the value -> meaning pairs from TYPO3 V13 onwards, allowing integrators to switch from one FE user self-registration extension to another without data loss/data corruption. This change does this in a way that allows those extensions to migrate their data. This change is only about porting the existing gender field from these extensions to the Core and forcing uniform values. It's not about introducing a general salutation field. (If someone would like to add that in a separate change, I'd welcome that.)
  22. Benni Mack wrote 07/16/24, 12:05

    Removed cc Benni Mack.
  23. Fabien Udriot voted on patch set 6 CR +1 07/16/24, 12:32

  24. Jigal van Hemert commented on patch set 6 07/23/24, 08:16

    Reply Unresolved

    Although I understand the technical desire to unify a field which is used by several extensions there are also different questions. Not everything that is provided by extensions (widely used or not) must make its way into the core. The authors of the three most used extensions could simply agree among themselves to standardize the values for their gender field. Another thing is if we actually want such a field in the core. There is a tendency in governments to not register gender when it's not required (Germany doesn't show it on ID cards, Belgium and the Netherlands will do that in the near future; it's still required on passports by European regulation). If you take a look at the fields in fe_users and realize how limited they are for international use then we should actually remove most of them and provide a series of generic fields (with practical use). Adding a controversial field for technical reasons is not something I would vote for.
    See reply in a thread to patchset 4. I'd vote -1 for the feature itself (not about reasing/testing the code itself)
  25. Oliver Klee abandoned the change 08/25/24, 10:10