Jump to content

Email and age verification


kyaj323

Recommended Posts

Hi All,

Need a little help with a few things.

1. I want to keep my contact form email separate from all order activities.

For example, CustomerCare would be used to communicate with customers using contact us.

However, I want to send all order communications via [email protected]. Customer places an order, shipping tracking, all order status from [email protected]

I checked mail alert, but it is for admins to receive the notification for orders only.

 

2. birthday verification. I did find a topic which restricts moving forward in the checkout if your younger than 18, however, i like to add another condition. Must be older than 18 but younger than 100. Its just trying to avoid someone putting 1900. Open to suggestion

3. Another issue with the code, if someone puts "0000-00-00" in the birthday field it breaks the site. white page(balnk). Instead of a white page, can it say input correct birthday using format Eg. 12-12-2001

<?php
//User age verification 18 years and older
class Validate extends ValidateCore
{

public static function isBirthDate($date, $format = 'Y-m-d')
    {
        if (empty($date) || $date == '0000-00-00') {
            return true;
        }

        $d = DateTime::createFromFormat($format, $date);
        if (!empty(DateTime::getLastErrors()['warning_count']) || false === $d) {
            return false;
        }
        
        $d->add(new DateInterval("P18Y"));
        return $d->setTime(0, 0, 0)->getTimestamp() <= time();
    }
}

 

4. Because the age is younger than 18 it shows format should be 05/31/1970. I like to say you must be 18 years or older to proceed.

image.png.245075f6ddca412358393888d71222e1.png

 

Thanks for all the help

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...