How to determine user age of 13 y.o.?

PatriaCo
PatriaCo
@the-patria-company
7 years ago
349 posts
How would I write the {if} statement calculation to determine a day/month/year that is over 13years from current_day?

I have a "profile" birth date field set up for children, whose parents are able to manage their child's profile. It is set up using the "custom form designer" in the "profile settings area" as a date_birthday type.

I wish this worked:
{if $profile_birth_date > (smarty.now + 13y)}



--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

updated by @the-patria-company: 05/19/17 09:35:53AM
paul
@paul
7 years ago
4,331 posts
{if $profile_birth_date + (13 * 31536000) >= $smarty.now}

31536000 is the number of seconds in a year.
hth


--
Paul Asher - JR Developer and System Import Specialist
michael
@michael
7 years ago
7,746 posts
There's lots of examples around for smarty :)

http://stackoverflow.com/questions/3248825/smarty-and-date#3260024

Quote:
{$smarty.now} is a simple timestamp (number of seconds since 1970). So you can just add as many seconds to it as you need:

{$smarty.now+20*24*60*60|date_format:'%Y-%m-%d %H:%M:%S'} //+20 days

So you just need to figure out how many seconds in 13 years and add that.
paul
@paul
7 years ago
4,331 posts
Is $profile_birth_date in UnixTime or is it yyyymmdd ?


--
Paul Asher - JR Developer and System Import Specialist

updated by @paul: 02/15/17 01:39:48PM
gary.moncrieff
gary.moncrieff
@garymoncrieff
7 years ago
865 posts
Wow I thought I was the only one concerned about the lack of privacy options in Jamroom, particularly for children/younger members.
brian
@brian
7 years ago
10,148 posts
gary.moncrieff:
Wow I thought I was the only one concerned about the lack of privacy options in Jamroom, particularly for children/younger members.

There is no way to systematically verify or enforce age restrictions online, so not sure what is missing. Jamroom is already setup to work correctly:

1) Set your signup to "admin validated"
2) Have your members who signup send or fax you "proof" of their age
3) authorize their account if things line up

Anything else is just a game and can't be relied on.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 02/16/17 11:55:55AM

Tags