Hi,
Also not sure if possible but user is 17yo and comes of age of 18 to able to automatically switch user to adult? hence why I'd like to use date/age field if possible or another dob type field. If not possible at least I know when user becomes of age I can manually change usergroup.
No Sorry, you can do this with another extension.
I think for example "Admin Tools" allow you to schedule query.
Now I've tried doing this but with date field but options such as date range - only past date and offsets doesn't seem to make any effect on the calendar (does this feature work yet?) because it doesn't stop user from saying he is born in 2017.. I might be doing it wrong thou but did notice its the same on your registration on this site.
Have you tried to set in date field this parameter:
- Date Range: Only Past date
-
Offset Year: -14
Some Tips to check year and add to teen or adults usergroup:
You can write a plugin to change group from date field, so you can follow these steps:
- Go to
https://www.easy-profile.com/docs/44-triggers.html
- Download, install and enable the skeleton plugin (downloadable at end of page)
- Go to /plugins/jsn/skeleton/skeleton-php
- Remove the samples functions: triggerFieldAvatarUpdate, triggerProfileUpdate
- write a function like this
triggerFieldDate_of_birthUpdate($user,&$data,$changed,$isNew){
$timestamp = strtotime('-18 years');
$testDate = date('Y-m-d', $timestamp);
if($data['date_of_birth']>$testDate){
$usergroup=<insert id of teen group>
JsnHelper::addUserToGroup($user,$usergroup);
$usergroup=<insert id of adult group>
JsnHelper::removeUserFromGroup($user,$usergroup);
}
else{
$usergroup=<insert id of adult group>
JsnHelper::addUserToGroup($user,$usergroup);
$usergroup=<insert id of teen group>
JsnHelper::removeUserFromGroup($user,$usergroup);
}
}
With this code on every update or registration the system assign correct usergroup.
NOTE: We have not tested this