Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Allow empty birthdate for Users
In one of our portals we allow users to register themselves. We also ask for the birthdate, but that is not a required field.
If you do not enter a birthdate, it seems that Liferay saves 1970-01-01 as the birthdate. Is it possible somehow to differ between users who do not have a birthdate and users which are really born on 1970-01-01? What would be the best approach here?
If you do not enter a birthdate, it seems that Liferay saves 1970-01-01 as the birthdate. Is it possible somehow to differ between users who do not have a birthdate and users which are really born on 1970-01-01? What would be the best approach here?
Please share the Liferay Version you are using
Nothing productive to add but one of our users was furious that we had allowed his birthday to be seen in Liferay and that he hadn't given consent for us to have it. His birthday was Jan 1st 1970. Legit story. Why do we have birthdate in liferay? If for audience targeting just a year would do. Same for gender.
Well, I actually had a client who showed the birthdays of the week in his portal. Without the age, of course, just that somebody has a birthday. So, we wouldn't have needed a year, just the month and day. It's terribly hard to make everybody happy ...
And it is actually a bit annoying that the gender field is a boolean. We have customers in the medical area who need the gender "unspecified". Also, with the transgender movement and everything, maybe this field should actually be changed to something more flexible.
And it is actually a bit annoying that the gender field is a boolean. We have customers in the medical area who need the gender "unspecified". Also, with the transgender movement and everything, maybe this field should actually be changed to something more flexible.
I don't think it is possible to distinguish afterwards. The only idea I have is to create a UserLocalServiceWrapper and change the birthdate in addUserWithWorkflow to something impossible like 1800-01-01. Assuming that you don't create users with a birthdate, of course.
And then ask the users gently to set their birthdate.
And then ask the users gently to set their birthdate.
Back in 6.2, birthday and gender could be disabled through portal.properties.
This is no longer in the list for 7.2, making me expect that these properties have moved to OSGi configuration values. I currently have no time to hunt for them, but maybe the possibility for configuring this makes you confident enough to go look for it. I try to remember this and look for it later, if nobody preempts me.
This is no longer in the list for 7.2, making me expect that these properties have moved to OSGi configuration values. I currently have no time to hunt for them, but maybe the possibility for configuring this makes you confident enough to go look for it. I try to remember this and look for it later, if nobody preempts me.
It's still there. Under Instance settings.
Yep, birthday can be disabled (enabled by default in my 7.2.x build) at Instance Settings > Users > Fields
Enable Gender and Autogenerate Screen Names booleans are also there.
See attached.
Enable Gender and Autogenerate Screen Names booleans are also there.
See attached.
Attachments:
Thank you for all the answers and the interesting discussion.
For my case I will probably try to change the "default" date from 1970-01-01 to something else like 1800-01-01.
For my case I will probably try to change the "default" date from 1970-01-01 to something else like 1800-01-01.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™