diff --git a/plugins/cipf_plugin/fipfcard_plugin.php b/plugins/cipf_plugin/fipfcard_plugin.php index 7ce951b..e6fe561 100644 --- a/plugins/cipf_plugin/fipfcard_plugin.php +++ b/plugins/cipf_plugin/fipfcard_plugin.php @@ -43,7 +43,6 @@ include_once(PLGNTLS_class::get_path() . '/php/hide_admin.php'); include_once(PLGNTLS_class::get_path() . 'php/register_partenaires.php'); include_once(PLGNTLS_class::get_path() . 'php/redirections.php'); include_once(PLGNTLS_class::get_path() . 'php/author_restriction.php'); -include_once(PLGNTLS_class::get_path() . 'php/reset_acf_fields.php'); include_once(PLGNTLS_class::get_path() . 'php/filter_mail.php'); include_once(PLGNTLS_class::get_path() . 'php/prof_check_page.php'); include_once(PLGNTLS_class::get_path() . 'php/renew_card.php'); diff --git a/plugins/cipf_plugin/php/renew_card.php b/plugins/cipf_plugin/php/renew_card.php index b72553e..2a1d0d4 100644 --- a/plugins/cipf_plugin/php/renew_card.php +++ b/plugins/cipf_plugin/php/renew_card.php @@ -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'); - - - - - ?> diff --git a/plugins/cipf_plugin/php/reset_acf_fields.php b/plugins/cipf_plugin/php/reset_acf_fields.php deleted file mode 100644 index bbae57d..0000000 --- a/plugins/cipf_plugin/php/reset_acf_fields.php +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/plugins/cipf_plugin/utils/plgntls_class.php b/plugins/cipf_plugin/utils/plgntls_class.php index 3b50a72..9c33b1a 100644 --- a/plugins/cipf_plugin/utils/plgntls_class.php +++ b/plugins/cipf_plugin/utils/plgntls_class.php @@ -64,6 +64,7 @@ class PLGNTLS_class const ACF_CARD_EXPIRATION = 'fin_de_validite'; CONST ACF_PROF_IS_ACTIV = 'compte-actif'; CONST ACF_PROF_CAN_RENEW = 'renouvellement_possible'; + CONST ACF_PROF_CGV = 'cgv'; const CARD_RENEW_PERIOD = 31; // int : number of days before expiration when renew card start to be possible const CARD_VALIDITY_TIME = '1 year'; // string : time of validity of the card (ex: '1 month' or '1 year' or '60 days')