Stop users enter wrong date of birth

I was tired of users entering wrong birth dates while joining if they don't use the date picker control. So i created a simple function that stops them to submit the form if it is an invalid date.

Add this function to the end of /inc/design.inc.php right before the ?>

function checkDateTime($data) {
    if (date('Y-m-d', strtotime($data)) == $data) {
        return true;
    } else {
        return false;
    }
}

Then go to dolphins admin area -> Builders -> Profile Fields -> Join Form

Click on the DateOfBrith Field and select "Advanced" Tab.

Put this into the "Check" field and save the field.

return (bool) (checkDateTime($arg0));

Next add a language key with the name _FieldError_Email_Check and put in something like "Invalid Date"

I still use 7.0.9 so i don't know if something changed with 7.1.0 but it should work there too.

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 24 May 2013

Sweet! I don't have that problem but it is good to do as extra check.

I'm still at .9 on couple site as well.

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 24 May 2013

great thanks a lot :)

would you happen to know how to set a min age for sign up?

Quote · 26 Nov 2014

 

great thanks a lot :)

would you happen to know how to set a min age for sign up?

You set that in the administration panel.

Geeks, making the world a better place
Quote · 26 Nov 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.