moved and updated reset fields into rebew file
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
?>
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user