- card date validation now uses direct card duration, not a parameter - checker for both types of transfert valid and invalid - mv checks for transfert and date expiration in specific functions
67 lines
1.1 KiB
PHP
67 lines
1.1 KiB
PHP
<?php
|
|
|
|
/*
|
|
* it means someone outside wp is accessing the file, in this case kill it.
|
|
*/
|
|
if (!defined('ABSPATH')) {
|
|
die('You can not access this file!');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* if field transfert-validation is not checked, do nothing
|
|
* else
|
|
* first reset the field
|
|
* then
|
|
* if no transfert was waiting, do nothing
|
|
* when transfert is validate :
|
|
* - change card to valid
|
|
* - update date
|
|
*
|
|
*/
|
|
function handle_transfert_validation_CIPF($user_id) {
|
|
PLGNTLS_class::debug_infos();
|
|
if (false === is_transfert_success_CIPF($user_id)) {
|
|
return;
|
|
}
|
|
reset_acf_transfert_CIPF($user_id);
|
|
if (false === is_account_waiting_transfert_CIPF($user_id)) {
|
|
return;
|
|
}
|
|
set_account_valid_CIPF($user_id);
|
|
update_card_expiration_CIPF($user_id);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* if card expire, makes some changes
|
|
*
|
|
*/
|
|
function handle_card_expire_CIPF($user_id) {
|
|
PLGNTLS_class::debug_infos();
|
|
if (false === card_date_exists_CIPF($user_id)) {
|
|
return;
|
|
}
|
|
if (false === is_card_date_expired_CIPF($user_id)) {
|
|
return;
|
|
}
|
|
if (false === is_account_expired_CIPF($user_id)) {
|
|
set_account_expired_CIPF($user_id);
|
|
}
|
|
if (is_account_waiting_valid_CIPF($user_id)) {
|
|
set_account_waiting_invalid_CIPF($user_id);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|