diff --git a/Verify.php b/Verify.php new file mode 100644 index 0000000..edbdb6b --- /dev/null +++ b/Verify.php @@ -0,0 +1,52 @@ +isEmailAddressVerified()==false) + { + // message + return array("You must first verify your email address before completing any order"); + } + } + } +}); + +# Deactivate unverified account after x days +add_hook("DailyCronJob", 1, function($vars){ + if (intval(DEACTIVATEACCOUNTAFTERXDAYS)!==0){ + $dateCreated = date("Y-m-d", strtotime("now - ".intval(DEACTIVATEACCOUNTAFTERXDAYS)." days")); + $getAccounts = Capsule::table("tblclients")->where("datecreated", "=", $dateCreated)->where("email_verified", "=", 0); + foreach ($getAccounts->get() as $account){ + Capsule::table("tblclients")->where("id", $account->id)->update(array("status" => "Inactive")); + } + } +}); + +# Close unverified accounts after X days +add_hook("DailyCronJob", 1, function($vars){ + if (intval(CLOSEACCOUNTAFTERXDAYS)!==0){ + $dateCreated = date("Y-m-d", strtotime("now - ".intval(CLOSEACCOUNTAFTERXDAYS)." days")); + $getAccounts = Capsule::table("tblclients")->where("datecreated", "=", $dateCreated)->where("email_verified", "=", 0); + foreach ($getAccounts->get() as $account){ + Capsule::table("tblclients")->where("id", $account->id)->update(array("status" => "Closed")); + } + } +}); \ No newline at end of file