Need some guidance on custom profile field that's a birthdate + mySQL usage

Started by rcane, November 29, 2022, 10:17:46 AM

Previous topic - Next topic

rcane

I need custom field to collect members' dates of birth. 

However, I know mySQL has a specific format for Date values.

Since I need to calculate who is over a specific age, I'm guessing the format entered has to be in the sql DATE format--to do the math.

BUT, I know the users, and even with a description showing the proper format for the date I'll end up getting one in cuneiform.

So, is there something simple I'm overlooking or should I just go with a simple php/html page and tuck it in it's own table--requiring them to enter the birthdate using the clickable calendar in html?

Just looking for ideas to make it easy on both parties.

Kindred

1- SMF already has a birth date field as a fixed field in the profile.
2- SMF currently stores the data in that field as SQL type "date" which is yyyy-mm-dd

3. in order to do the same thing with custom profile fields, you would have to have 3 fields (year) (month) (day)
and probably choose a "select box" option...

However, a better choice would be to just change the code a little bit to require the defined birthdate field on registration.
template_profile_birthdate() is in profile.template.php
modify template_registration_form() in registration.template.php
to either add the function call or copy the contents into the reg form
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

rcane

I recall seeing, but I think I may have commented it out, because at the time there was a LOAD of confusion about who could see whose age (please, I get it, I really do).

Anyway, yeah, the custom profile field is the wrong way to go.  Too much work. 
I made a simple calendar input to start with that works fine and 'views' with the members table when I run a master query-- if I go that way.  But, if I can just use the stock birthdate (thanks for confirming it goes to the right date format; i did see that when poking around in the profile.template.) I'd rather go that route.

But, I can't find the registration.template.php--where is that?

profile.template.php looks fine and has nothing that I touched.  I'm not sure where I may have commented it out.

Shades.

ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

rcane

Did a search and found where I asked about removing that, last year.  Found the comment marks to remove and play with it.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."


Steve

DO NOT pm me for support!

Advertisement: