As an administrator on my forum site, I would like all members to state their year of birth when registering. This is important since it helps me understand how popular the site is among different age groups.
The functionality above can be achieved by the following steps:
- Edit the fields for user accounts. These are at Admin / Configuration / Account Settings / Managed Fields, not under Admin / Structure
- Add a new field of the type integer, for example with label year of birth and the name field_user_birthyear.
- Saving the field list will open the settings for the new field.
- As integer fields lack site-global settings, you can just hit save field settings to continue to the configuration used on user accounts only.
- Mark the field as required, which automatically includes it on the registration form for the site.
- Write a help text explaining how the information this new field provides will or will not be used.
- Set minimum to 1900 and maximum to 2012 to prevent users from providing nonsense years.
TIP: The Date module provides entity fields for dates and times, which in this case would be a good alternative to using an integer field.