event deletion account reminder

This commit is contained in:
asus
2024-04-09 23:20:35 +02:00
parent 1775c86c25
commit 215d778307
2 changed files with 21 additions and 9 deletions

View File

@@ -146,16 +146,27 @@ add_action('CIPF_reminder_before_card_expire', 'send_emails_CIPF', 10, 2);
/*
* 6. && 7. prof, send email reminder account deletion
*
function schedule__CIPF($user_id) {
Plgntls::debug_infos();
$delay = strtotime('+3 days');
wp_schedule_single_event($delay, 'scedule_event_CIPF', array($user_id));
}
function event_CIPF($user_id) {
Plgntls::debug_infos();
}
add_action('schedule_event_CIPF', 'event_CIPF', 10, 2);
*/
function schedule_reminder_before_account_delete_CIPF($user_id) {
Plgntls::debug_infos();
$account_reminder_1 = Cipf::DURATION_REMINDER_BEFORE_ACCOUNT_DELETE_FIRST;
$account_reminder_2 = Cipf::DURATION_REMINDER_BEFORE_ACCOUNT_DELETE_LAST;
$duration_deletion = Cipf::DURATION_ACCOUNT_DELETE_AFTER_EXPIRE;
$date_limit = get_card_date_expiration_CIPF($user_id);
if (false === $date_limit) {
return;
}
$new_date = $date_limit->modify($duration_deletion);
$new_date_1 = $new_date->modify($account_reminder_1);
$new_date_2 = $new_date->modify($account_reminder_2);
$delay_1 = $new_date_1->getTimestamp();
$delay_2 = $new_date_2->getTimestamp();
wp_schedule_single_event($delay_1, 'CIPF_reminder_before_account_delete', array('account_will_be_deleted', $user_id));
wp_schedule_single_event($delay_2, 'CIPF_reminder_before_account_delete', array('account_will_be_deleted', $user_id));
}
add_action('CIPF_reminder_before_account_delete', 'send_emails_CIPF', 10, 2);

View File

@@ -177,6 +177,7 @@ function success_payment_for_user_CIPF($user_id, $order_id) {
schedule_deactivate_expired_card_CIPF($user_id);
schedule_prof_account_deletion_CIPF($user_id);
schedule_reminder_before_card_expire_CIPF($user_id);
schedule_reminder_before_account_delete_CIPF($user_id);
if (is_card_new_CIPF($user_id)) {
set_card_number_CIPF($user_id);