'renouvellement' * */ set_account_valid_CIPF($user_id); update_card_date_expiration_CIPF($user_id); set_card_number_CIPF($user_id); set_card_renew_CIPF($user_id); send_emails_CIPF('transfert_success', $user_id); } /* * if card expire, makes some changes * */ function handle_card_expire_CIPF($user_id) { Plgntls::debug_infos(); if (false === isset_acf_card_expiration_CIPF($user_id)) { return; } if (is_card_date_expired_CIPF($user_id)) { if (is_account_waiting_transfert_CIPF($user_id)) { set_account_waiting_invalid_CIPF($user_id); } else { set_account_expired_CIPF($user_id); } send_emails_CIPF('account_expired', $user_id); } else { if (is_account_waiting_transfert_CIPF($user_id)) { set_account_waiting_valid_CIPF($user_id); } else { set_account_valid_CIPF($user_id); } } } /* * this function will delete the account if the deletion date is expired * it is called both by e scheduled event, and every time a prof go on its page * */ function handle_prof_account_deletion_CIPF($user_id) { Plgntls::debug_infos(); /* * check if account still exists * */ if (false === get_user_by('id', $user_id)) { return; } /* * check if account should be deleted * */ if (!is_prof_account_deletion_date_exceeded_CIPF($user_id)) { return; } send_emails_CIPF('account_deleted', $user_id); include_once(ABSPATH.'wp-admin/includes/user.php'); wp_delete_user($user_id); } ?>