moved and updated reset fields into rebew file

This commit is contained in:
asus
2024-03-07 23:48:01 +01:00
parent 909a34cd37
commit 022468c096
4 changed files with 34 additions and 30 deletions

View File

@@ -9,6 +9,33 @@ if (!defined('ABSPATH')) {
/*
* reset some fields for the form to buy the card
* - cgv
* - paiement
* - livraison
* - tarif
* this action is called if no redirection happens
*
*/
function reset_some_fields_CIPF() {
$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;
$user_id = get_current_user_id();
update_field($acf_cgv , array(""), 'user_'.$user_id);
update_field($acf_payement, array(""), 'user_'.$user_id);
update_field($acf_delivery, array(""), 'user_'.$user_id);
update_field($acf_price , array(""), 'user_'.$user_id);
}
/*
* prevent users to fill the renew form if
* they are not prof and logged in,
@@ -50,10 +77,16 @@ function renew_page_restrictions_CIPF(){
}
exit;
*/
reset_some_fields_CIPF();
}
add_action('template_redirect', 'renew_page_restrictions_CIPF');
/*
* #cipf_prof_carte_commande -> default display: block;
* #cipf_prof_carte_renouvellement -> default display: none;
@@ -86,9 +119,4 @@ add_action('wp_enqueue_scripts', 'renew_page_filter_message_CIPF');
?>

View File

@@ -1,24 +0,0 @@
<?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!');
}
/*
function reset_some_fields_CIPF($form_id, $user_id, $post_array) {
*/
function reset_some_fields_CIPF() {
$user_id = get_current_user_id();
update_field('cgv', array(""), 'user_'.$user_id);
update_field('paiement', array(""), 'user_'.$user_id);
update_field('livraison', array(""), 'user_'.$user_id);
}
add_action('df_after_insert_user', 'reset_some_fields_CIPF');
?>