diff --git a/plugins/cipf_plugin/php/_actions_scheduled_events.php b/plugins/cipf_plugin/php/_actions_scheduled_events.php index e158daa..42995ff 100644 --- a/plugins/cipf_plugin/php/_actions_scheduled_events.php +++ b/plugins/cipf_plugin/php/_actions_scheduled_events.php @@ -81,19 +81,19 @@ add_action('CIPF_orderid_deletion_event', 'delete_order_id_later_CIPF', 10, 2); * need to include file for wp_delete_user to work : https://developer.wordpress.org/reference/functions/wp_delete_user/ * */ -function schedule_prof_account_deletion_CIPF($user_id) { - Plgntls::debug_infos(); - $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); - $delay = $new_date->getTimestamp(); - wp_schedule_single_event($delay, 'CIPF_prof_account_deletion', array($user_id)); -} -add_action('CIPF_prof_account_deletion', 'handle_prof_account_deletion_CIPF'); +//function schedule_prof_account_deletion_CIPF($user_id) { +// Plgntls::debug_infos(); +// $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); +// $delay = $new_date->getTimestamp(); +// wp_schedule_single_event($delay, 'CIPF_prof_account_deletion', array($user_id)); +//} +//add_action('CIPF_prof_account_deletion', 'handle_prof_account_deletion_CIPF'); @@ -102,18 +102,18 @@ add_action('CIPF_prof_account_deletion', 'handle_prof_account_deletion_CIPF'); * 3. prof, deactivate card at expiration time, also email * */ -function schedule_deactivate_expired_card_CIPF($user_id) { - Plgntls::debug_infos(); - - $date_limit = get_card_date_expiration_CIPF($user_id); - if (false === $date_limit) { - return; - } - $new_date = $date_limit->modify('+1 day'); - $delay = $new_date->getTimestamp(); - wp_schedule_single_event($delay, 'CIPF_deactivate_expired_card', array($user_id)); -} -add_action('CIPF_deactivate_expired_card', 'handle_card_expire_CIPF'); +//function schedule_deactivate_expired_card_CIPF($user_id) { +// Plgntls::debug_infos(); +// +// $date_limit = get_card_date_expiration_CIPF($user_id); +// if (false === $date_limit) { +// return; +// } +// $new_date = $date_limit->modify('+1 day'); +// $delay = $new_date->getTimestamp(); +// wp_schedule_single_event($delay, 'CIPF_deactivate_expired_card', array($user_id)); +//} +//add_action('CIPF_deactivate_expired_card', 'handle_card_expire_CIPF'); @@ -122,50 +122,50 @@ add_action('CIPF_deactivate_expired_card', 'handle_card_expire_CIPF'); * 4. && 5. prof, send email reminder before account expire * */ -function schedule_reminder_before_card_expire_CIPF($user_id) { - Plgntls::debug_infos(); - $card_reminder_1 = Cipf::DURATION_REMINDER_BEFORE_ACCOUNT_EXPIRE_FIRST; - $card_reminder_2 = Cipf::DURATION_REMINDER_BEFORE_ACCOUNT_EXPIRE_LAST; - - $date_limit = get_card_date_expiration_CIPF($user_id); - if (false === $date_limit) { - return; - } - $new_date_1 = $date_limit->modify($card_reminder_1); - $new_date_2 = $date_limit->modify($card_reminder_2); - $delay_1 = $new_date_1->getTimestamp(); - $delay_2 = $new_date_2->getTimestamp(); - wp_schedule_single_event($delay_1, 'CIPF_reminder_before_card_expire', array($user_id, $card_reminder_1)); - wp_schedule_single_event($delay_2, 'CIPF_reminder_before_card_expire', array($user_id, $card_reminder_2)); -} -function send_emails_reminder_before_card_expire_CIPF($user_id, $duration) { - Plgntls::debug_infos(); - - if (!isset_acf_card_expiration_CIPF($user_id)) { - return; - } - if (is_card_date_expired_CIPF($user_id)) { - return; - } - $date_limit = get_card_date_expiration_CIPF($user_id); - if (false === $date_limit) { - return; - } - - $date_reminder = $date_limit->modify($duration); - $date_diff = date_diff($date_limit, $date_reminder); - $date_diff = (int)$date_diff->format('%R%a'); - - $date_now = date_create('now'); - $current_date_diff = date_diff($date_limit, $date_now); - $current_date_diff = (int)$current_date_diff->format('%R%a'); - - // i add +3 in case there is a difference of maximum 3 days between a 31 days month and a 28 days february - if (abs($current_date_diff) <= (abs($date_diff + 3))) { - send_emails_CIPF('card_will_expire', $user_id); - } -} -add_action('CIPF_reminder_before_card_expire', 'send_emails_reminder_before_card_expire_CIPF', 10, 2); +//function schedule_reminder_before_card_expire_CIPF($user_id) { +// Plgntls::debug_infos(); +// $card_reminder_1 = Cipf::DURATION_REMINDER_BEFORE_ACCOUNT_EXPIRE_FIRST; +// $card_reminder_2 = Cipf::DURATION_REMINDER_BEFORE_ACCOUNT_EXPIRE_LAST; +// +// $date_limit = get_card_date_expiration_CIPF($user_id); +// if (false === $date_limit) { +// return; +// } +// $new_date_1 = $date_limit->modify($card_reminder_1); +// $new_date_2 = $date_limit->modify($card_reminder_2); +// $delay_1 = $new_date_1->getTimestamp(); +// $delay_2 = $new_date_2->getTimestamp(); +// wp_schedule_single_event($delay_1, 'CIPF_reminder_before_card_expire', array($user_id, $card_reminder_1)); +// wp_schedule_single_event($delay_2, 'CIPF_reminder_before_card_expire', array($user_id, $card_reminder_2)); +//} +//function send_emails_reminder_before_card_expire_CIPF($user_id, $duration) { +// Plgntls::debug_infos(); +// +// if (!isset_acf_card_expiration_CIPF($user_id)) { +// return; +// } +// if (is_card_date_expired_CIPF($user_id)) { +// return; +// } +// $date_limit = get_card_date_expiration_CIPF($user_id); +// if (false === $date_limit) { +// return; +// } +// +// $date_reminder = $date_limit->modify($duration); +// $date_diff = date_diff($date_limit, $date_reminder); +// $date_diff = (int)$date_diff->format('%R%a'); +// +// $date_now = date_create('now'); +// $current_date_diff = date_diff($date_limit, $date_now); +// $current_date_diff = (int)$current_date_diff->format('%R%a'); +// +// // i add +3 in case there is a difference of maximum 3 days between a 31 days month and a 28 days february +// if (abs($current_date_diff) <= (abs($date_diff + 3))) { +// send_emails_CIPF('card_will_expire', $user_id); +// } +//} +//add_action('CIPF_reminder_before_card_expire', 'send_emails_reminder_before_card_expire_CIPF', 10, 2); @@ -174,55 +174,55 @@ add_action('CIPF_reminder_before_card_expire', 'send_emails_reminder_before_card * 6. && 7. prof, send email reminder account deletion * */ -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; - } - - $date_deletion = $date_limit->modify($duration_deletion); - $new_date_1 = $date_deletion->modify($account_reminder_1); - $new_date_2 = $date_deletion->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($user_id, $account_reminder_1)); - wp_schedule_single_event($delay_2, 'CIPF_reminder_before_account_delete', array($user_id, $account_reminder_2)); -} -function send_emails_reminder_before_account_delete_CIPF($user_id, $duration) { - Plgntls::debug_infos(); - $duration_deletion = Cipf::DURATION_ACCOUNT_DELETE_AFTER_EXPIRE; - - if (!isset_acf_card_expiration_CIPF($user_id)) { - return; - } - if (!is_card_date_expired_CIPF($user_id)) { - return; - } - $date_limit = get_card_date_expiration_CIPF($user_id); - if (false === $date_limit) { - return; - } - - $date_deletion = $date_limit->modify($duration_deletion); - $date_reminder = $date_deletion->modify($duration); - $date_diff = date_diff($date_deletion, $date_reminder); - $date_diff = (int)$date_diff->format('%R%a'); - - $date_now = date_create('now'); - $current_date_diff = date_diff($date_deletion, $date_now); - $current_date_diff = (int)$current_date_diff->format('%R%a'); - - // i add +3 in case there is a difference of maximum 3 days between a 31 days month and a 28 days february - if (abs($current_date_diff) <= (abs($date_diff + 3))) { - send_emails_CIPF('account_will_be_deleted', $user_id); - } -} -add_action('CIPF_reminder_before_account_delete', 'send_emails_reminder_before_account_delete_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; +// } +// +// $date_deletion = $date_limit->modify($duration_deletion); +// $new_date_1 = $date_deletion->modify($account_reminder_1); +// $new_date_2 = $date_deletion->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($user_id, $account_reminder_1)); +// wp_schedule_single_event($delay_2, 'CIPF_reminder_before_account_delete', array($user_id, $account_reminder_2)); +//} +//function send_emails_reminder_before_account_delete_CIPF($user_id, $duration) { +// Plgntls::debug_infos(); +// $duration_deletion = Cipf::DURATION_ACCOUNT_DELETE_AFTER_EXPIRE; +// +// if (!isset_acf_card_expiration_CIPF($user_id)) { +// return; +// } +// if (!is_card_date_expired_CIPF($user_id)) { +// return; +// } +// $date_limit = get_card_date_expiration_CIPF($user_id); +// if (false === $date_limit) { +// return; +// } +// +// $date_deletion = $date_limit->modify($duration_deletion); +// $date_reminder = $date_deletion->modify($duration); +// $date_diff = date_diff($date_deletion, $date_reminder); +// $date_diff = (int)$date_diff->format('%R%a'); +// +// $date_now = date_create('now'); +// $current_date_diff = date_diff($date_deletion, $date_now); +// $current_date_diff = (int)$current_date_diff->format('%R%a'); +// +// // i add +3 in case there is a difference of maximum 3 days between a 31 days month and a 28 days february +// if (abs($current_date_diff) <= (abs($date_diff + 3))) { +// send_emails_CIPF('account_will_be_deleted', $user_id); +// } +//} +//add_action('CIPF_reminder_before_account_delete', 'send_emails_reminder_before_account_delete_CIPF', 10, 2); @@ -231,31 +231,31 @@ add_action('CIPF_reminder_before_account_delete', 'send_emails_reminder_before_a * 8. partner, send email before offer expire * */ -function schedule_partner_before_offer_expire_CIPF($user_id) { - Plgntls::debug_infos(); - $offer_expire = Cipf::DURATION_REMINDER_BEFORE_OFFER_EXPIRE; - -// error_log("is_offer_1: " . json_encode(is_activ_partner_offer_1_date_CIPF($post_id))); -// error_log("offer_1 date: " . json_encode(get_partner_offer_1_date_CIPF($post_id))); -// error_log("is_offer_2: " . json_encode(is_activ_partner_offer_2_date_CIPF($post_id))); -// error_log("offer_2 date: " . json_encode(get_partner_offer_2_date_CIPF($post_id))); -// error_log("is_offer_3: " . json_encode(is_activ_partner_offer_3_date_CIPF($post_id))); -// error_log("offer_3 date: " . json_encode(get_partner_offer_3_date_CIPF($post_id))); -// $date_limit = get_card_date_expiration_CIPF($user_id); - if (false === $date_limit) { - return; - } - - $new_date = $date_limit->modify($offer_expire); - $delay = $new_date->getTimestamp(); - wp_schedule_single_event($delay, 'CIPF_partner_before_offer_expire', array($user_id)); -} -function send_emails_reminder_before_offer_expire_CIPF($user_id) { - Plgntls::debug_infos(); - - send_emails_CIPF('offer_will_expire', $user_id); -} -add_action('CIPF_partner_before_offer_expire', 'send_emails_reminder_before_offer_expire_CIPF'); +//function schedule_partner_before_offer_expire_CIPF($user_id) { +// Plgntls::debug_infos(); +// $offer_expire = Cipf::DURATION_REMINDER_BEFORE_OFFER_EXPIRE; +// +//// error_log("is_offer_1: " . json_encode(is_activ_partner_offer_1_date_CIPF($post_id))); +//// error_log("offer_1 date: " . json_encode(get_partner_offer_1_date_CIPF($post_id))); +//// error_log("is_offer_2: " . json_encode(is_activ_partner_offer_2_date_CIPF($post_id))); +//// error_log("offer_2 date: " . json_encode(get_partner_offer_2_date_CIPF($post_id))); +//// error_log("is_offer_3: " . json_encode(is_activ_partner_offer_3_date_CIPF($post_id))); +//// error_log("offer_3 date: " . json_encode(get_partner_offer_3_date_CIPF($post_id))); +//// $date_limit = get_card_date_expiration_CIPF($user_id); +// if (false === $date_limit) { +// return; +// } +// +// $new_date = $date_limit->modify($offer_expire); +// $delay = $new_date->getTimestamp(); +// wp_schedule_single_event($delay, 'CIPF_partner_before_offer_expire', array($user_id)); +//} +//function send_emails_reminder_before_offer_expire_CIPF($user_id) { +// Plgntls::debug_infos(); +// +// send_emails_CIPF('offer_will_expire', $user_id); +//} +//add_action('CIPF_partner_before_offer_expire', 'send_emails_reminder_before_offer_expire_CIPF'); diff --git a/plugins/cipf_plugin/php/partners_form.php b/plugins/cipf_plugin/php/partners_form.php index 8633132..31eb5df 100644 --- a/plugins/cipf_plugin/php/partners_form.php +++ b/plugins/cipf_plugin/php/partners_form.php @@ -125,39 +125,6 @@ function partner_after_form_CIPF($form_id, $post_array, $form_type) { $post_id = $post_array['ID']; } add_action('df_after_process', 'partner_after_form_CIPF', 10, 3); -/* -is_offer_1: false -offer_1 date: {"date":"2024-04-10 00:15:06.000000","timezone_type":3,"timezone":"UTC"} -is_offer_2: true -offer_2 date: {"date":"2024-04-18 00:15:06.000000","timezone_type":3,"timezone":"UTC"} -is_offer_3: false -offer_3 date: false - - - - - -form_id: "crea_partenaire" - -post_array: { - "post_status":"publish", - "field_title":["Nom commercial","Votre site Internet","Dans quelle rubrique devez-vous para\u00eetre ? ","L\\'accroche en t\u00eate de page","Pr\u00e9sentez-vous","Votre logo ","Image principale","Voulez-vous afficher cette offre ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","Voulez-vous afficher cette offre ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","Voulez-vous afficher cette offre ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","slug"], - "post_title":"La FIPF", - "meta_input":{"url_partenaire":"","_url_partenaire":"field_65cb83096d020","logo_partenaire":"40770","_logo_partenaire":"field_65cb79150ac4f","afficher_offre_1":"Afficher","_afficher_offre_1":"field_65d8cf09395a5","duree_offre_1":"Permanente","_duree_offre_1":"field_65f81843cc36e","fin_offre_1":[],"offre_1_titre":"La F\u00e9d\u00e9ration internationale des professeurs de fran\u00e7ais","_offre_1_titre":"field_65d8bbf6b4651","offre_1_txt":"Participez \u00e0 tous les congr\u00e8s de la FIPF au tarif \u00ab\u00a0membre\u00a0\u00bb (r\u00e9duction de 20% en moyenne) et gagnez les actes du dernier congr\u00e8s mondial \u00e0 Li\u00e8ge en version \u00e9lectronique.\r\nAcc\u00e9dez gratuitement \u00e0 la biblioth\u00e8que num\u00e9rique de la FIPF, qui regroupe les anciens num\u00e9ros du \u00ab\u00a0Fran\u00e7ais dans le monde\u00a0\u00bb et des \u00ab\u00a0Dialogues et Cultures\u00a0\u00bb (et d\u2019autres publications qui seront encore ajout\u00e9es).","_offre_1_txt":"field_65d8bc395bf88","offre_1_image":"","_offre_1_image":"field_65d8bc5d5bf8b","afficher_offre_2":"Masquer","_afficher_offre_2":"field_65e20fb8785ba","duree_offre_2":[],"fin_offre_2":[],"offre_2_titre":[],"offre_2_txt":[],"offre_2_image":"41438","_offre_2_image":"field_65d8bc6e5bf8c","afficher_offre_3":"Masquer","_afficher_offre_3":"field_65d8cf48395a6","duree_offre_3":[],"fin_offre_3":[],"offre_3_titre":[],"offre_3_txt":[],"offre_3_image":"","_offre_3_image":"field_65d8bc8c5bf8e"}, - "tax_input":{"category":[1]}, - "post_excerpt":"R\u00e9duction de 20 % aux congr\u00e8s et acc\u00e8s \u00e0 la biblioth\u00e8que num\u00e9rique", - "post_content":"La F\u00e9d\u00e9ration Internationale des Professeurs de Fran\u00e7ais anime depuis 1969\u00a0le r\u00e9seau mondial des associations d\u2019enseignants de fran\u00e7ais<\/strong>. Elle contribue au d\u00e9veloppement des associations affili\u00e9es et, \u00e0 travers elles, \u00e0 la promotion de la langue fran\u00e7aise. Au service de la communaut\u00e9 internationale des professeurs de fran\u00e7ais, la FIPF est un acteur important de la francophonie.\r\nLa FIPF, c\u2019est aujourd\u2019hui\u00a0200 associations locales<\/strong>\u00a0et nationales et\u00a080 000 enseignants<\/strong>, dans plus de\u00a0120 pays des 5 continents<\/strong>. La FIPF s\u2019adresse non seulement aux professeurs de fran\u00e7ais \u2013 langue maternelle, langue seconde ou langue \u00e9trang\u00e8re \u2013 adh\u00e9rents du r\u00e9seau FIPF, mais aussi \u00e0 tous les professeurs de fran\u00e7ais \u00e0 travers le monde, ainsi qu\u2019\u00e0 tous les passionn\u00e9s de la langue fran\u00e7aise et des cultures francophones.\r\n\r\nBienvenue \u00e0 tous les amis de la francophonie !", - "_ajax_linking_nonce":"540c4df3e2", - "post_thumbnail":"40771", - "post_name":"la-fipf", - "ID":"40772", - "form_type_confirm":"", - "post_type":"post", - "post_date":"2024-03-08 06:44:39" -} - -form_type: "post" -*/ diff --git a/plugins/cipf_plugin/php/paypal/update_user_payment.php b/plugins/cipf_plugin/php/paypal/update_user_payment.php index 1aad15c..5b5929e 100644 --- a/plugins/cipf_plugin/php/paypal/update_user_payment.php +++ b/plugins/cipf_plugin/php/paypal/update_user_payment.php @@ -174,10 +174,6 @@ function success_payment_for_user_CIPF($user_id, $order_id) { * */ update_card_date_expiration_CIPF($user_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); diff --git a/plugins/cipf_plugin/php/paypal/user_can_pay.php b/plugins/cipf_plugin/php/paypal/user_can_pay.php index e6439be..bc59293 100644 --- a/plugins/cipf_plugin/php/paypal/user_can_pay.php +++ b/plugins/cipf_plugin/php/paypal/user_can_pay.php @@ -56,8 +56,6 @@ function check_can_pay_CIPF() { -//schedule_prof_account_deletion_CIPF($user_id); - /* * check if payment is virement or immediat *