fixed error in handling emails reminder for profs card
This commit is contained in:
@@ -784,6 +784,42 @@ function reset_emails_reminders_choices_CIPF($user_id = null) {
|
|||||||
$acf_id = 'user_'.$user_id;
|
$acf_id = 'user_'.$user_id;
|
||||||
set_acf_field_CIPF($acf_emails_reminders, array(), $acf_id);
|
set_acf_field_CIPF($acf_emails_reminders, array(), $acf_id);
|
||||||
}
|
}
|
||||||
|
function reset_emails_reminders_expiration_card_CIPF($user_id = null) {
|
||||||
|
Plgntls::debug_infos();
|
||||||
|
$acf_emails_reminders = Cipf::ACF_EMAILS_REMINDERS;
|
||||||
|
|
||||||
|
if (is_null($user_id)) {
|
||||||
|
$user_id = get_current_user_id();
|
||||||
|
}
|
||||||
|
$acf_id = 'user_'.$user_id;
|
||||||
|
|
||||||
|
$reminders_choices = get_emails_reminders_choices_CIPF($user_id);
|
||||||
|
foreach ($reminders_choices as $reminder_key => $value) {
|
||||||
|
$explode_reminder = explode('/', $reminder_key);
|
||||||
|
$explode_reminder = array_map('trim', $explode_reminder);
|
||||||
|
if ($explode_reminder[0] === 'card_expiration') {
|
||||||
|
unset_email_reminder_choice_CIPF($reminder_key, $user_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function reset_emails_reminders_deletion_account_CIPF($user_id = null) {
|
||||||
|
Plgntls::debug_infos();
|
||||||
|
$acf_emails_reminders = Cipf::ACF_EMAILS_REMINDERS;
|
||||||
|
|
||||||
|
if (is_null($user_id)) {
|
||||||
|
$user_id = get_current_user_id();
|
||||||
|
}
|
||||||
|
$acf_id = 'user_'.$user_id;
|
||||||
|
|
||||||
|
$reminders_choices = get_emails_reminders_choices_CIPF($user_id);
|
||||||
|
foreach ($reminders_choices as $reminder_key => $value) {
|
||||||
|
$explode_reminder = explode('/', $reminder_key);
|
||||||
|
$explode_reminder = array_map('trim', $explode_reminder);
|
||||||
|
if ($explode_reminder[0] === 'account_deletion') {
|
||||||
|
unset_email_reminder_choice_CIPF($reminder_key, $user_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ function handle_card_expire_CIPF($user_id) {
|
|||||||
else {
|
else {
|
||||||
set_account_valid_CIPF($user_id);
|
set_account_valid_CIPF($user_id);
|
||||||
}
|
}
|
||||||
|
reset_emails_reminders_deletion_account_CIPF($user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +129,6 @@ function handle_prof_account_deletion_CIPF($user_id) {
|
|||||||
*/
|
*/
|
||||||
function handle_reminders_before_card_expire_CIPF($user_id) {
|
function handle_reminders_before_card_expire_CIPF($user_id) {
|
||||||
Plgntls::debug_infos();
|
Plgntls::debug_infos();
|
||||||
$card_reminders = Cipf::DURATION_REMINDERS_BEFORE_ACCOUNT_EXPIRE;
|
|
||||||
$emails_reminders = Cipf:: ACF_EMAILS_REMINDERS;
|
$emails_reminders = Cipf:: ACF_EMAILS_REMINDERS;
|
||||||
|
|
||||||
if (!isset_acf_card_expiration_CIPF($user_id)) {
|
if (!isset_acf_card_expiration_CIPF($user_id)) {
|
||||||
@@ -142,23 +142,16 @@ function handle_reminders_before_card_expire_CIPF($user_id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_before_reminders = false;
|
$is_before_reminders = true;
|
||||||
$reminder_list = array();
|
$reminders_choices = get_emails_reminders_choices_CIPF($user_id);
|
||||||
foreach ($card_reminders as $reminder_key => $value) {
|
foreach ($reminders_choices as $reminder_key => $value) {
|
||||||
$duration = get_duration_CIPF($reminder_key, 'card_expiration');
|
$duration = get_duration_CIPF($reminder_key, 'card_expiration');
|
||||||
/*
|
|
||||||
* if false, this reminder is not for 'card_expiration'
|
|
||||||
* else, add to 'reminder_list'
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if (false === $duration) {
|
if (false === $duration) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$reminder_list[] = $reminder_key;
|
|
||||||
|
|
||||||
$diff = compare_diff_with_today_CIPF($date_limit, $duration);
|
$diff = compare_diff_with_today_CIPF($date_limit, $duration);
|
||||||
if ($diff > 0) {
|
if ($diff > 0) {
|
||||||
$is_before_reminders = true;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$is_before_reminders = false;
|
$is_before_reminders = false;
|
||||||
@@ -179,9 +172,7 @@ function handle_reminders_before_card_expire_CIPF($user_id) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($is_before_reminders) {
|
if ($is_before_reminders) {
|
||||||
foreach ($reminder_list as $reminder) {
|
reset_emails_reminders_expiration_card_CIPF($user_id);
|
||||||
unset_email_reminder_choice_CIPF($reminder, $user_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +194,7 @@ function handle_reminders_before_account_deleted_CIPF($user_id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!is_card_date_expired_CIPF($user_id)) {
|
if (!is_card_date_expired_CIPF($user_id)) {
|
||||||
|
reset_emails_reminders_deletion_account_CIPF($user_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$date_limit = get_card_date_expiration_CIPF($user_id);
|
$date_limit = get_card_date_expiration_CIPF($user_id);
|
||||||
@@ -212,8 +204,7 @@ function handle_reminders_before_account_deleted_CIPF($user_id) {
|
|||||||
$date_deletion = $date_limit->modify($duration_deletion);
|
$date_deletion = $date_limit->modify($duration_deletion);
|
||||||
|
|
||||||
|
|
||||||
$is_before_reminders = false;
|
$is_before_reminders = true;
|
||||||
$reminder_list = array();
|
|
||||||
/*
|
/*
|
||||||
* get the acf reminders,
|
* get the acf reminders,
|
||||||
* - continue the ones not for account deletion
|
* - continue the ones not for account deletion
|
||||||
@@ -224,19 +215,12 @@ function handle_reminders_before_account_deleted_CIPF($user_id) {
|
|||||||
$reminders_choices = get_emails_reminders_choices_CIPF($user_id);
|
$reminders_choices = get_emails_reminders_choices_CIPF($user_id);
|
||||||
foreach ($reminders_choices as $reminder_key => $value) {
|
foreach ($reminders_choices as $reminder_key => $value) {
|
||||||
$duration = get_duration_CIPF($reminder_key, 'account_deletion');
|
$duration = get_duration_CIPF($reminder_key, 'account_deletion');
|
||||||
/*
|
|
||||||
* if false, this reminder is not for 'card_expiration'
|
|
||||||
* else, add to 'reminder_list'
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if (false === $duration) {
|
if (false === $duration) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$reminder_list[] = $reminder_key;
|
|
||||||
|
|
||||||
$diff = compare_diff_with_today_CIPF($date_deletion, $duration);
|
$diff = compare_diff_with_today_CIPF($date_deletion, $duration);
|
||||||
if ($diff > 0) {
|
if ($diff > 0) {
|
||||||
$is_before_reminders = true;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$is_before_reminders = false;
|
$is_before_reminders = false;
|
||||||
@@ -260,9 +244,7 @@ function handle_reminders_before_account_deleted_CIPF($user_id) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($is_before_reminders) {
|
if ($is_before_reminders) {
|
||||||
foreach ($reminder_list as $reminder) {
|
reset_emails_reminders_deletion_account_CIPF($user_id);
|
||||||
unset_email_reminder_choice_CIPF($reminder, $user_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user