wip check offres for newsletter

This commit is contained in:
asus
2024-03-11 23:20:38 +01:00
parent 046b31579c
commit 591add448f
4 changed files with 151 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ include_once(PLGNTLS_class::root_path() . 'php/author_restriction.php');
include_once(PLGNTLS_class::root_path() . 'php/filter_mail.php');
include_once(PLGNTLS_class::root_path() . 'php/prof_check_page.php');
include_once(PLGNTLS_class::root_path() . 'php/renew_card.php');
include_once(PLGNTLS_class::root_path() . 'php/partner_check_page.php');
// form builder patch :

View File

@@ -0,0 +1,126 @@
<?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!');
}
/*
* series of actions to do before printing a partner author page
*
function check_partner_page_CIPF() {
PLGNTLS_class::debug_infos();
// the way to find the id of the author of an author_page
$author_id = get_queried_object_id();
}
add_action('template_redirect', 'check_partner_page_CIPF', 11);
*/
/*
in test_partner_CIPF
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 ?",
"Titre",
"Texte de l\\'offre",
"Image (facultatif)",
"Voulez-vous ajouter une offre ?",
"Voulez-vous afficher cette offre ?",
"Titre",
"Texte de l\\'offre",
"Image (facultatif)",
"Voulez-vous ajouter une offre ?",
"Voulez-vous afficher l\\'offre ?",
"Titre",
"Texte de l\\'offre",
"Image (facultatif)",
"slug"
],
"post_title":"test page partner",
"meta_input":[
"de_fb_url_partenaire",
"de_fb_logo_partenaire",
"de_fb_afficher_offre_1",
"de_fb_offre_1_titre",
"de_fb_offre_1_txt",
"de_fb_offre_1_image",
"de_fb_ajouter_offre_2",
"de_fb_afficher_offre_2",
"de_fb_offre_2_titre",
"de_fb_offre_2_txt",
"de_fb_offre_2_image",
"de_fb_ajouter_offre_3",
"de_fb_afficher_offre_3",
"de_fb_offre_3_titre",
"de_fb_offre_3_txt",
"de_fb_offre_3_image"
],
"url_partenaire":"",
"tax_input":["de_fb_category"],
"category":"autres",
"post_excerpt":"accroche test page partner",
"post_content":"presentation test page partner",
"_ajax_linking_nonce":"2088c0ea4f",
"logo_partenaire":"40763",
"post_thumbnail":"40764",
"afficher_offre_1":"Afficher",
"offre_1_titre":"titre offre 1",
"offre_1_txt":"text offre 1",
"offre_1_image":"",
"ajouter_offre_2":"Oui",
"afficher_offre_2":"Masquer",
"offre_2_titre":"titre offre 2",
"offre_2_txt":"text offre 2",
"offre_2_image":"",
"ajouter_offre_3":"Oui",
"afficher_offre_3":"Afficher",
"offre_3_titre":"titre offre 3",
"offre_3_txt":"text offre 3",
"offre_3_image":"",
"post_name":"test-page-partner",
"ID":"40765",
"form_type_confirm":""
}
form_type
"post"
*/
function test_partner_CIPF($form_id, $post_array, $form_type) {
error_log("---");
error_log("in test_partner_CIPF");
error_log("form_id");
error_log(json_encode($form_id));
error_log("post_array");
error_log(json_encode($post_array));
error_log("form_type");
error_log(json_encode($form_type));
}
add_action( 'df_before_process', 'test_partner_CIPF', 10, 3);
?>

View File

@@ -172,6 +172,7 @@ function failure_payment_for_user_CIPF($user_id, $order_id, $status) {
*/
function validate_payment_for_user_CIPF($user_id, $order_id) {
PLGNTLS_class::debug_infos();
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
$acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION;
$acf_card_number = PLGNTLS_class::ACF_CARD_NUMBER;
@@ -179,6 +180,12 @@ function validate_payment_for_user_CIPF($user_id, $order_id) {
$prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV;
$acf_payment_status = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
$meta_order_id = PLGNTLS_class::META_ORDER_ID;
/*
$acf_cgv = PLGNTLS_class::ACF_PROF_CGV;
$acf_payement = PLGNTLS_class::ACF_CARD_PAYMENT_METHOD;
$acf_delivery = PLGNTLS_class::ACF_CARD_PRICE_DELIVERY;
$acf_price = PLGNTLS_class::ACF_CARD_PRICE_CHOICE;
*/
$acf_id = 'user_'.$user_id;
@@ -256,6 +263,22 @@ function validate_payment_for_user_CIPF($user_id, $order_id) {
*/
update_field($prof_is_activ['_name'], $prof_is_activ['activ'], $acf_id);
update_field($acf_payment_status['_name'], $acf_payment_status['success'], $acf_id);
/*
* reset some fields for the form to buy the card
* - cgv
* - paiement
* - livraison
* - tarif
*
* could make sense to put it here,
* but actually it needs to be put at begining of form
*
update_field($acf_cgv['_name'] , array(""), 'user_'.$user_id);
update_field($acf_payement['_name'], array(""), 'user_'.$user_id);
update_field($acf_delivery['_name'], array(""), 'user_'.$user_id);
update_field($acf_price['_name'] , array(""), 'user_'.$user_id);
*/
}

Submodule private updated: 516706ca48...a85c727e9d