improved check before sending reminder emails

This commit is contained in:
asus
2024-04-10 11:55:28 +02:00
parent 215d778307
commit 5cde5cd913
9 changed files with 231 additions and 68 deletions

View File

@@ -80,10 +80,16 @@ class Cipf {
const ACF_CARD_PAYMENT_STATE = ['_name'=>'etat_paiement', 'started'=>'en_cours', 'success'=>'reussi', 'failure'=>'echec', 'nothing'=>'aucun']; // radio button const ACF_CARD_PAYMENT_STATE = ['_name'=>'etat_paiement', 'started'=>'en_cours', 'success'=>'reussi', 'failure'=>'echec', 'nothing'=>'aucun']; // radio button
const ACF_ACCOUNT_STATE = ['_name'=>'etat_compte', 'new'=>'nouveau prof', 'to_pay'=>'doit payer', 'valid'=>'carte valide', 'waiting_invalid'=>'en attente invalide', 'waiting_valid'=>'en attente valide', 'expired'=>'carte expiree']; const ACF_ACCOUNT_STATE = ['_name'=>'etat_compte', 'new'=>'nouveau prof', 'to_pay'=>'doit payer', 'valid'=>'carte valide', 'waiting_invalid'=>'en attente invalide', 'waiting_valid'=>'en attente valide', 'expired'=>'carte expiree'];
const ACF_TRANSFERT_STATE = ['_name'=>'etat_virement', 'success'=>'virement validé']; const ACF_TRANSFERT_STATE = ['_name'=>'etat_virement', 'success'=>'virement validé'];
const ACF_PAGE_STATE = ['_name'=>'etat_page_partenaire', 'publish'=>'Publiee', 'draft'=>'Brouillon'];
const ACF_CARD_ORDER_ID = ['_name'=>'order_id']; const ACF_CARD_ORDER_ID = ['_name'=>'order_id'];
const ACF_HISTORY = ['_name'=>'history']; const ACF_HISTORY = ['_name'=>'historique'];
const ACF_PROF_CHANGE_CARD = ['_name'=>'changement_de_carte']; const ACF_PROF_CHANGE_CARD = ['_name'=>'changement_de_carte'];
const ACF_PAGE_STATE = ['_name'=>'etat_page_partenaire', 'publish'=>'Publiee', 'draft'=>'Brouillon'];
const ACF_PARTNER_DATE_OFFER_1 = ['_name'=>'fin_offre_1'];
const ACF_PARTNER_DATE_OFFER_2 = ['_name'=>'fin_offre_2'];
const ACF_PARTNER_DATE_OFFER_3 = ['_name'=>'fin_offre_3'];
const ACF_PARTNER_OFFER_1_DURATION = ['_name'=>'duree_offre_1', 'no-end'=>'Permanente', 'end'=>'Temporaire'];
const ACF_PARTNER_OFFER_2_DURATION = ['_name'=>'duree_offre_2', 'no-end'=>'Permanente', 'end'=>'Temporaire'];
const ACF_PARTNER_OFFER_3_DURATION = ['_name'=>'duree_offre_3', 'no-end'=>'Permanente', 'end'=>'Temporaire'];
// META // META
const META_PAYEMENT_STATUS = 'cipf_payement_status'; const META_PAYEMENT_STATUS = 'cipf_payement_status';
@@ -293,14 +299,15 @@ contactez la fipf directement",
// FORMS // FORMS
const FORM_PROF_COMMANDE_ID = 'prof_commande'; const FORM_PROF_COMMANDE_ID = 'prof_commande';
const FORM_PROF_TRANSFERT_ID = 'prof_valide_virement'; const FORM_PROF_TRANSFERT_ID = 'prof_valide_virement';
const FORM_PARTNER_PAGE_ID = 'crea_partenaire';
// DURATIONS // DURATIONS
const DURATION_CARD_VALIDITY = '+1 year'; // string : time of validity of the card (ex: '1 month' or '1 year' or '60 days') const DURATION_CARD_VALIDITY = '+1 year'; // string : time of validity of the card (ex: '1 month' or '1 year' or '60 days')
const DURATION_OLD_ORDER_ID = '+3 days'; const DURATION_OLD_ORDER_ID = '+3 days';
const DURATION_ACCOUNT_DELETE_AFTER_EXPIRE = '+6 months'; const DURATION_ACCOUNT_DELETE_AFTER_EXPIRE = '+6 months';
const DURATION_REMINDER_BEFORE_ACCOUNT_EXPIRE_FIRST = '-1 month'; const DURATION_REMINDER_BEFORE_ACCOUNT_EXPIRE_FIRST = '-30 days';
const DURATION_REMINDER_BEFORE_ACCOUNT_EXPIRE_LAST = '-7 days'; const DURATION_REMINDER_BEFORE_ACCOUNT_EXPIRE_LAST = '-7 days';
const DURATION_REMINDER_BEFORE_ACCOUNT_DELETE_FIRST = '-1 month'; const DURATION_REMINDER_BEFORE_ACCOUNT_DELETE_FIRST = '-30 days';
const DURATION_REMINDER_BEFORE_ACCOUNT_DELETE_LAST = '-7 days'; const DURATION_REMINDER_BEFORE_ACCOUNT_DELETE_LAST = '-7 days';
const DURATION_REMINDER_BEFORE_OFFER_EXPIRE = '-7 days'; const DURATION_REMINDER_BEFORE_OFFER_EXPIRE = '-7 days';

View File

@@ -0,0 +1,6 @@
#your-profile .acf-field.textarea_full_width {
textarea {
width: 100%;
max-width: 100%;
}
}

View File

@@ -135,10 +135,37 @@ function schedule_reminder_before_card_expire_CIPF($user_id) {
$new_date_2 = $date_limit->modify($card_reminder_2); $new_date_2 = $date_limit->modify($card_reminder_2);
$delay_1 = $new_date_1->getTimestamp(); $delay_1 = $new_date_1->getTimestamp();
$delay_2 = $new_date_2->getTimestamp(); $delay_2 = $new_date_2->getTimestamp();
wp_schedule_single_event($delay_1, 'CIPF_reminder_before_card_expire', array('card_will_expire', $user_id)); 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('card_will_expire', $user_id)); wp_schedule_single_event($delay_2, 'CIPF_reminder_before_card_expire', array($user_id, $card_reminder_2));
} }
add_action('CIPF_reminder_before_card_expire', 'send_emails_CIPF', 10, 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);
@@ -158,15 +185,44 @@ function schedule_reminder_before_account_delete_CIPF($user_id) {
return; return;
} }
$new_date = $date_limit->modify($duration_deletion); $date_deletion = $date_limit->modify($duration_deletion);
$new_date_1 = $new_date->modify($account_reminder_1); $new_date_1 = $date_deletion->modify($account_reminder_1);
$new_date_2 = $new_date->modify($account_reminder_2); $new_date_2 = $date_deletion->modify($account_reminder_2);
$delay_1 = $new_date_1->getTimestamp(); $delay_1 = $new_date_1->getTimestamp();
$delay_2 = $new_date_2->getTimestamp(); $delay_2 = $new_date_2->getTimestamp();
wp_schedule_single_event($delay_1, 'CIPF_reminder_before_account_delete', array('account_will_be_deleted', $user_id)); 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('account_will_be_deleted', $user_id)); wp_schedule_single_event($delay_2, 'CIPF_reminder_before_account_delete', array($user_id, $account_reminder_2));
} }
add_action('CIPF_reminder_before_account_delete', 'send_emails_CIPF', 10, 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);
@@ -174,16 +230,32 @@ add_action('CIPF_reminder_before_account_delete', 'send_emails_CIPF', 10, 2);
/* /*
* 8. partner, send email before offer expire * 8. partner, send email before offer expire
* *
function schedule__CIPF($user_id) {
Plgntls::debug_infos();
$delay = strtotime('+3 days');
wp_schedule_single_event($delay, 'scedule_event_CIPF', array($user_id));
}
function event_CIPF($user_id) {
Plgntls::debug_infos();
}
add_action('schedule_event_CIPF', 'event_CIPF', 10, 2);
*/ */
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');

View File

@@ -16,11 +16,9 @@ if (!defined('ABSPATH')) {
* or false if not set * or false if not set
* *
*/ */
function get_date_CIPF($acf_date, $user_id) { function get_date_CIPF($acf_date, $acf_id) {
Plgntls::debug_infos(); Plgntls::debug_infos();
$acf_id = 'user_'.$user_id;
/* /*
* get acf date field * get acf date field
* *
@@ -149,7 +147,9 @@ function get_card_date_expiration_CIPF($user_id = null) {
if (is_null($user_id)) { if (is_null($user_id)) {
$user_id = get_current_user_id(); $user_id = get_current_user_id();
} }
return get_date_CIPF($acf_card_expiration, $user_id); $acf_id = 'user_'.$user_id;
return get_date_CIPF($acf_card_expiration, $acf_id);
} }
function is_card_date_expired_CIPF($user_id = null) { function is_card_date_expired_CIPF($user_id = null) {
Plgntls::debug_infos(); Plgntls::debug_infos();
@@ -216,4 +216,48 @@ function is_prof_account_deletion_date_exceeded_CIPF($user_id = null) {
} }
/*
* partner offers
*
*/
function get_partner_offer_1_date_CIPF($post_id) {
Plgntls::debug_infos();
$offer_1 = Cipf::ACF_PARTNER_DATE_OFFER_1;
return get_date_CIPF($offer_1, $post_id);
}
function get_partner_offer_2_date_CIPF($post_id) {
Plgntls::debug_infos();
$offer_2 = Cipf::ACF_PARTNER_DATE_OFFER_2;
return get_date_CIPF($offer_2, $post_id);
}
function get_partner_offer_3_date_CIPF($post_id) {
Plgntls::debug_infos();
$offer_3 = Cipf::ACF_PARTNER_DATE_OFFER_3;
return get_date_CIPF($offer_3, $post_id);
}
function is_activ_partner_offer_1_date_CIPF($post_id) {
Plgntls::debug_infos();
$offer_1_duration = Cipf::ACF_PARTNER_OFFER_1_DURATION;
return is_acf_field_CIPF($offer_1_duration, 'end', $post_id);
}
function is_activ_partner_offer_2_date_CIPF($post_id) {
Plgntls::debug_infos();
$offer_2_duration = Cipf::ACF_PARTNER_OFFER_2_DURATION;
return is_acf_field_CIPF($offer_2_duration, 'end', $post_id);
}
function is_activ_partner_offer_3_date_CIPF($post_id) {
Plgntls::debug_infos();
$offer_3_duration = Cipf::ACF_PARTNER_OFFER_3_DURATION;
return is_acf_field_CIPF($offer_3_duration, 'end', $post_id);
}
?> ?>

View File

@@ -53,6 +53,7 @@ if (!defined('ABSPATH')) {
function get_field_init_CIPF($acf_field_name, $acf_id) { function get_field_init_CIPF($acf_field_name, $acf_id) {
Plgntls::debug_infos(); Plgntls::debug_infos();
$acf_state = get_field($acf_field_name, $acf_id); $acf_state = get_field($acf_field_name, $acf_id);

View File

@@ -11,19 +11,32 @@ if (!defined('ABSPATH')) {
/* /*
* load css for when fipf is weing user profil in admin
* 278 : ../../../wordpress_docker/volumes/wp_volume/wp-admin/user-edit.php * 278 : ../../../wordpress_docker/volumes/wp_volume/wp-admin/user-edit.php
* *
function admin_user_profil_css_CIPF($user_id) {
*/ */
function admin_user_profil_css_CIPF() { function admin_user_profil_css_CIPF() {
Plgntls::debug_infos(); Plgntls::debug_infos();
$role_fipf = Cipf::ROLE_FIPF; $role_fipf = Cipf::ROLE_FIPF;
/*
* for everyone viewing user profil
*
*/
Plgntls::add_to_front(array('css/user_profile.css'));
if (!current_user_can($role_fipf)) { if (!current_user_can($role_fipf)) {
return; return;
} }
/*
* for fipf viewing user profil
*
*/
Plgntls::add_to_front(array('css/fipf_user_profile.css')); Plgntls::add_to_front(array('css/fipf_user_profile.css'));
} }
add_action('user_edit_form_tag', 'admin_user_profil_css_CIPF'); add_action('user_edit_form_tag', 'admin_user_profil_css_CIPF');

View File

@@ -103,4 +103,63 @@ add_action('template_redirect', 'partner_form_creation_page_CIPF');
/*
* actions after partner form is validated
*
*/
function partner_after_form_CIPF($form_id, $post_array, $form_type) {
Plgntls::debug_infos(2);
$form_partner_id = Cipf::FORM_PARTNER_PAGE_ID;
if ($form_partner_id !== $form_id) {
return;
}
Plgntls::debug_infos();
// error_log("form_id: " . json_encode($form_id));
// error_log("post_array: " . json_encode($post_array));
// error_log("form_type: " . json_encode($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\u00a0<strong>le 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\u00a0<strong>200 associations locales<\/strong>\u00a0et nationales et\u00a0<strong>80 000 enseignants<\/strong>, dans plus de\u00a0<strong>120 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"
*/
?> ?>

View File

@@ -266,46 +266,6 @@ function partner_page_check_url_CIPF() {
} }
add_action('template_redirect', 'partner_page_check_url_CIPF', 9); add_action('template_redirect', 'partner_page_check_url_CIPF', 9);
/*
global $wp;
error_log("wp: " . json_encode($wp));
error_log("wp->request: " . json_encode($wp->request));
error_log("url: " . json_encode($url));
error_log("current_url: " . json_encode($current_url));
error_log("current_post->post_name: " . json_encode($current_post->post_name));
error_log("get_page_uri: " . json_encode(get_page_uri()));
error_log("_SERVER: " . json_encode($_SERVER));
error_log("_SERVER[REQUEST_URI]: " . json_encode(trim($_SERVER['REQUEST_URI'], '/')));
error_log("_REQUEST: " . json_encode($_REQUEST));
error_log("_GET: " . json_encode($_GET));
error_log("_POST: " . json_encode($_POST));
wp: {"public_query_vars":{"0":"m","1":"p","2":"posts","3":"w","4":"cat","5":"withcomments","6":"withoutcomments","7":"s","8":"search","9":"exact","10":"sentence","11":"calendar","12":"page","13":"paged","14":"more","15":"tb","16":"pb","17":"author","18":"order","19":"orderby","20":"year","21":"monthnum","22":"day","23":"hour","24":"minute","25":"second","26":"name","27":"category_name","28":"tag","29":"feed","30":"author_name","31":"pagename","32":"page_id","33":"error","34":"attachment","35":"attachment_id","36":"subpost","37":"subpost_id","38":"preview","39":"robots","40":"favicon","41":"taxonomy","42":"term","43":"cpage","44":"post_type","45":"embed","46":"post_format","50":"test","51":"rest_route","52":"sitemap","53":"sitemap-subtype","54":"sitemap-stylesheet","55":"action","56":"pid","57":"et_code_snippet_type","58":"et_pb_preview"},"private_query_vars":["offset","posts_per_page","posts_per_archive_page","showposts","nopaging","post_type","post_status","category__in","category__not_in","category__and","tag__in","tag__not_in","tag__and","tag_slug__in","tag_slug__and","tag_id","post_mime_type","perm","comments_per_page","post__in","post__not_in","post_parent","post_parent__in","post_parent__not_in","title","fields"],"extra_query_vars":[],"query_vars":{"page":"","name":"la-fipf"},"query_string":"name=la-fipf","request":"la-fipf","matched_rule":"([^\/]+)(?:\/([0-9]+))?\/?$","matched_query":"name=la-fipf&page=","did_permalink":true}
wp->request: "la-fipf"
url: "https:\/\/local-cipf-plugin.com\/la-fipf"
current_url: "https:\/\/local-cipf-plugin.com\/?p=40772"
current_post->post_name: "la-fipf"
get_page_uri: "la-fipf"
_SERVER: {"SERVER_SOFTWARE":"nginx\/1.20.2","REQUEST_URI":"\/la-fipf","USER":"www-data","HOME":"\/home\/www-data","HTTP_SEC_FETCH_SITE":"cross-site","HTTP_SEC_FETCH_MODE":"navigate","HTTP_SEC_FETCH_DEST":"document","HTTP_UPGRADE_INSECURE_REQUESTS":"1","HTTP_COOKIE":"wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_351da2be51e3820c1ef099eec9d2e669=La%20FIPF%7C1712428136%7CJuUiFWt1MLm3wKin6FPTbhpC3ivFGEEYerG8UHAQHeR%7Cf4901ba90d872ab24ae82115df09f1a978fc56fc647d40a6422a369eacd3a571; mjx.menu=renderer%3ANativeMML%26%3Bsemantics%3Atrue%26%3Bcontext%3ABrowser%26%3Bzoom%3ANone","HTTP_CONNECTION":"keep-alive","HTTP_SEC_GPC":"1","HTTP_DNT":"1","HTTP_ACCEPT_ENCODING":"gzip, deflate, br","HTTP_ACCEPT_LANGUAGE":"en-US,en;q=0.5","HTTP_ACCEPT":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/avif,image\/webp,*\/*;q=0.8","HTTP_USER_AGENT":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko\/20100101 Firefox\/124.0","HTTP_HOST":"local-cipf-plugin.com","REDIRECT_STATUS":"200","SERVER_NAME":"local-cipf-plugin.com","SERVER_PORT":"443","SERVER_ADDR":"172.20.0.4","REMOTE_PORT":"51368","REMOTE_ADDR":"172.20.0.1","GATEWAY_INTERFACE":"CGI\/1.1","HTTPS":"on","REQUEST_SCHEME":"https","SERVER_PROTOCOL":"HTTP\/1.1","DOCUMENT_ROOT":"\/var\/www\/html","DOCUMENT_URI":"\/index.php","SCRIPT_NAME":"\/index.php","CONTENT_LENGTH":"","CONTENT_TYPE":"","REQUEST_METHOD":"GET","QUERY_STRING":"q=\/la-fipf","SCRIPT_FILENAME":"\/var\/www\/html\/index.php","FCGI_ROLE":"RESPONDER","PHP_SELF":"\/index.php","REQUEST_TIME_FLOAT":1712259286.018937,"REQUEST_TIME":1712259286}
_SERVER[REQUEST_URI]: "la-fipf"
_REQUEST: {"q":"\/la-fipf"}
_GET: {"q":"\/la-fipf"}
_POST: []
wp: {"public_query_vars":{"0":"m","1":"p","2":"posts","3":"w","4":"cat","5":"withcomments","6":"withoutcomments","7":"s","8":"search","9":"exact","10":"sentence","11":"calendar","12":"page","13":"paged","14":"more","15":"tb","16":"pb","17":"author","18":"order","19":"orderby","20":"year","21":"monthnum","22":"day","23":"hour","24":"minute","25":"second","26":"name","27":"category_name","28":"tag","29":"feed","30":"author_name","31":"pagename","32":"page_id","33":"error","34":"attachment","35":"attachment_id","36":"subpost","37":"subpost_id","38":"preview","39":"robots","40":"favicon","41":"taxonomy","42":"term","43":"cpage","44":"post_type","45":"embed","46":"post_format","50":"test","51":"rest_route","52":"sitemap","53":"sitemap-subtype","54":"sitemap-stylesheet","55":"action","56":"pid","57":"et_code_snippet_type","58":"et_pb_preview"},"private_query_vars":["offset","posts_per_page","posts_per_archive_page","showposts","nopaging","post_type","post_status","category__in","category__not_in","category__and","tag__in","tag__not_in","tag__and","tag_slug__in","tag_slug__and","tag_id","post_mime_type","perm","comments_per_page","post__in","post__not_in","post_parent","post_parent__in","post_parent__not_in","title","fields"],"extra_query_vars":[],"query_vars":{"p":"40772"},"query_string":"p=40772","request":"","matched_rule":"","matched_query":"","did_permalink":false}
wp->request: ""
url: "https:\/\/local-cipf-plugin.com\/la-fipf"
current_url: "https:\/\/local-cipf-plugin.com\/?p=40772"
current_post->post_name: "la-fipf"
get_page_uri: "la-fipf"
_SERVER: {"SERVER_SOFTWARE":"nginx\/1.20.2","REQUEST_URI":"\/?p=40772","USER":"www-data","HOME":"\/home\/www-data","HTTP_SEC_FETCH_USER":"?1","HTTP_SEC_FETCH_SITE":"same-origin","HTTP_SEC_FETCH_MODE":"navigate","HTTP_SEC_FETCH_DEST":"document","HTTP_UPGRADE_INSECURE_REQUESTS":"1","HTTP_COOKIE":"wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_351da2be51e3820c1ef099eec9d2e669=La%20FIPF%7C1712428136%7CJuUiFWt1MLm3wKin6FPTbhpC3ivFGEEYerG8UHAQHeR%7Cf4901ba90d872ab24ae82115df09f1a978fc56fc647d40a6422a369eacd3a571; mjx.menu=renderer%3ANativeMML%26%3Bsemantics%3Atrue%26%3Bcontext%3ABrowser%26%3Bzoom%3ANone","HTTP_CONNECTION":"keep-alive","HTTP_SEC_GPC":"1","HTTP_DNT":"1","HTTP_REFERER":"https:\/\/local-cipf-plugin.com\/la-fipf","HTTP_ACCEPT_ENCODING":"gzip, deflate, br","HTTP_ACCEPT_LANGUAGE":"en-US,en;q=0.5","HTTP_ACCEPT":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/avif,image\/webp,*\/*;q=0.8","HTTP_USER_AGENT":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko\/20100101 Firefox\/124.0","HTTP_HOST":"local-cipf-plugin.com","REDIRECT_STATUS":"200","SERVER_NAME":"local-cipf-plugin.com","SERVER_PORT":"443","SERVER_ADDR":"172.20.0.4","REMOTE_PORT":"51368","REMOTE_ADDR":"172.20.0.1","GATEWAY_INTERFACE":"CGI\/1.1","HTTPS":"on","REQUEST_SCHEME":"https","SERVER_PROTOCOL":"HTTP\/1.1","DOCUMENT_ROOT":"\/var\/www\/html","DOCUMENT_URI":"\/index.php","SCRIPT_NAME":"\/index.php","CONTENT_LENGTH":"","CONTENT_TYPE":"","REQUEST_METHOD":"GET","QUERY_STRING":"p=40772","SCRIPT_FILENAME":"\/var\/www\/html\/index.php","FCGI_ROLE":"RESPONDER","PHP_SELF":"\/index.php","REQUEST_TIME_FLOAT":1712259296.724377,"REQUEST_TIME":1712259296}
_SERVER[REQUEST_URI]: "?p=40772"
_REQUEST: {"p":"40772"}
_GET: {"p":"40772"}
_POST: []
*/

View File

@@ -16,13 +16,14 @@ if (!defined('ABSPATH')) {
* *
*/ */
function prof_after_form_commande_CIPF($form_id, $post_array, $form_type) { function prof_after_form_commande_CIPF($form_id, $post_array, $form_type) {
Plgntls::debug_infos(); Plgntls::debug_infos(2);
$acf_account_state = Cipf::ACF_ACCOUNT_STATE; $acf_account_state = Cipf::ACF_ACCOUNT_STATE;
$form_prof_commande_id = Cipf::FORM_PROF_COMMANDE_ID; $form_prof_commande_id = Cipf::FORM_PROF_COMMANDE_ID;
if ($form_prof_commande_id !== $form_id) { if ($form_prof_commande_id !== $form_id) {
return; return;
} }
Plgntls::debug_infos();
//$user_id = get_current_user_id(); //$user_id = get_current_user_id();
$user_id = $post_array['ID']; $user_id = $post_array['ID'];