cipf v 0.5.5 added history and order id acf
This commit is contained in:
@@ -53,12 +53,14 @@ if (!defined('ABSPATH')) {
|
||||
* after 3 days ?
|
||||
*
|
||||
*/
|
||||
function schedule_delete_orderid_CIPF($user_id, $order_id) {
|
||||
function schedule_delete_orderid_CIPF($order_id, $user_id) {
|
||||
Plgntls::debug_infos();
|
||||
$delay = strtotime('+3 days');
|
||||
wp_schedule_single_event($delay, 'orderid_deletion_event_CIPF', array($user_id, $order_id));
|
||||
$duration_order_id = Cipf::DURATION_OLD_ORDER_ID;
|
||||
|
||||
$delay = strtotime($duration_order_id);
|
||||
wp_schedule_single_event($delay, 'orderid_deletion_event_CIPF', array($order_id, $user_id));
|
||||
}
|
||||
function delete_order_id_later_CIPF($user_id, $order_id) {
|
||||
function delete_order_id_later_CIPF($order_id, $user_id) {
|
||||
Plgntls::debug_infos();
|
||||
|
||||
if (!isset_acf_order_id_CIPF($user_id)) {
|
||||
@@ -76,43 +78,30 @@ add_action('orderid_deletion_event_CIPF', 'delete_order_id_later_CIPF', 10, 2);
|
||||
|
||||
/*
|
||||
* 2. prof, suppress account XX time after expiration, also email
|
||||
* need to include file for wp_delete_user to work : https://developer.wordpress.org/reference/functions/wp_delete_user/
|
||||
*
|
||||
*/
|
||||
function schedule_prof_account_suppression_CIPF($user_id) {
|
||||
function schedule_prof_account_deletion_CIPF($user_id) {
|
||||
Plgntls::debug_infos();
|
||||
$duration_deletion = Cipf::DURATION_ACCOUNT_DELETE_AFTER_EXPIRE;
|
||||
$date_limit = get_date_limit_CIPF($user_id);
|
||||
$time_limit = $date_limit->getTimestamp();
|
||||
//$date_interval = date_interval_create_from_date_string($duration_deletion);
|
||||
//$date_deletion = $date_limit->add($date_interval);
|
||||
$date_deletion = $date_limit->modify('+'.$duration_deletion);
|
||||
$time_deletion = $date_deletion->getTimestamp();
|
||||
//error_log("duration_deletion: " . json_encode($duration_deletion));
|
||||
//error_log("date_limit : " . json_encode($date_limit));
|
||||
//error_log("time_limit : " . json_encode($time_limit));
|
||||
////error_log("date_interval: " . json_encode($date_interval));
|
||||
//error_log("date_deletion: " . json_encode($date_deletion));
|
||||
//error_log("time_deletion: " . json_encode($time_deletion));
|
||||
/*
|
||||
duration_deletion: "6 months"
|
||||
date_limit : {"date":"2094-09-19 15:33:35.000000","timezone_type":3,"timezone":"UTC"}
|
||||
time_limit : 3919851215
|
||||
date_deletion: {"date":"2094-09-19 15:33:35.000000","timezone_type":3,"timezone":"UTC"}
|
||||
time_deletion: 3935748815
|
||||
|
||||
duration_deletion: "6 months"
|
||||
date_limit : {"date":"2094-09-19 15:32:03.000000","timezone_type":3,"timezone":"UTC"}
|
||||
time_limit : 3919851123
|
||||
date_deletion: {"date":"2094-09-19 15:32:03.000000","timezone_type":3,"timezone":"UTC"}
|
||||
time_deletion: 3935748723
|
||||
*/
|
||||
//$delay = strtotime('+3 days');
|
||||
// wp_schedule_single_event($delay, 'scedule_event_CIPF', array($user_id));
|
||||
// $duration_deletion = Cipf::DURATION_ACCOUNT_DELETE_AFTER_EXPIRE;
|
||||
//
|
||||
// $date_limit = get_date_limit_CIPF($user_id);
|
||||
// if (false === $date_limit) {
|
||||
// return;
|
||||
// }
|
||||
// $date_limit->modify($duration_deletion);
|
||||
// $delay = $date_limit->getTimestamp();
|
||||
// wp_schedule_single_event($delay, 'schedule_event_prof_account_deletion_CIPF', array($user_id));
|
||||
}
|
||||
//function event_CIPF($user_id) {
|
||||
//function event_prof_account_deletion_CIPF($user_id) {
|
||||
// Plgntls::debug_infos();
|
||||
// if (false === get_user_by('id', $user_id)) {
|
||||
// return;
|
||||
// }
|
||||
// include_once(ABSPATH.'wp-admin/includes/user.php');
|
||||
// wp_delete_user($user_id);
|
||||
//}
|
||||
//add_action('schedule_event_CIPF', 'event_CIPF', 10, 2);
|
||||
//add_action('schedule_event_prof_account_deletion_CIPF', 'event_prof_account_deletion_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
* [/] card expiration date ('fin_de_validite')
|
||||
*
|
||||
* [/] prof deletion date ('date_suppression_compte')
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -160,6 +162,12 @@ function set_acf_field_CIPF($acf_field, $acf_value, $acf_id) {
|
||||
*
|
||||
*/
|
||||
$new_value = get_acf_field_CIPF($acf_field, $acf_id);
|
||||
if (!is_string($old_value)) {
|
||||
$old_value = json_encode($old_value);
|
||||
}
|
||||
if (!is_string($new_value)) {
|
||||
$new_value = json_encode($new_value);
|
||||
}
|
||||
if ($new_value !== $old_value) {
|
||||
$old_history = get_acf_field_CIPF($acf_history, $acf_id);
|
||||
$france_timezone = new DateTimeZone("Europe/Paris");
|
||||
@@ -556,6 +564,26 @@ function isset_acf_card_expiration_CIPF($user_id = null) {
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* date_suppression_compte
|
||||
*
|
||||
*/
|
||||
function isset_acf_prof_account_delete_CIPF($user_id = null) {
|
||||
Plgntls::debug_infos();
|
||||
$acf_prof_delete = Cipf::ACF_PROF_DELETE_ACCOUNT;
|
||||
|
||||
if (is_null($user_id)) {
|
||||
$user_id = get_current_user_id();
|
||||
}
|
||||
$acf_id = 'user_'.$user_id;
|
||||
return isset_acf_field_CIPF($acf_prof_delete, $acf_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* order_id
|
||||
*
|
||||
|
||||
@@ -56,7 +56,7 @@ function check_can_pay_CIPF() {
|
||||
|
||||
|
||||
|
||||
schedule_prof_account_suppression_CIPF($user_id);
|
||||
schedule_prof_account_deletion_CIPF($user_id);
|
||||
|
||||
/*
|
||||
* check if payment is virement or immediat
|
||||
|
||||
@@ -95,7 +95,7 @@ function card_date_diff_CIPF($user_id = null) {
|
||||
|
||||
/*
|
||||
* returns true if date is in paste or is empty
|
||||
* use is_card_date_exists_CIPF to check if the field is empty
|
||||
* use card_date_exists_CIPF to check if the field is empty
|
||||
*
|
||||
*/
|
||||
function is_card_date_expired_CIPF($user_id = null) {
|
||||
|
||||
Reference in New Issue
Block a user