renew page message are working

This commit is contained in:
asus
2024-03-07 23:27:20 +01:00
parent 9b5e44dfd3
commit 909a34cd37
5 changed files with 29 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
/* /*
Plugin Name: cipfcard_plugin Plugin Name: cipf_plugin
Plugin URI: Plugin URI:
Description: Description:
Author: hugogogo Author: hugogogo
@@ -46,6 +46,7 @@ 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/reset_acf_fields.php');
include_once(PLGNTLS_class::get_path() . 'php/filter_mail.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/prof_check_page.php');
include_once(PLGNTLS_class::get_path() . 'php/renew_card.php');
// form builder patch : // form builder patch :
//include_once(PLGNTLS_class::get_path() . 'php/form_builder_patch/url_validation.php'); //include_once(PLGNTLS_class::get_path() . 'php/form_builder_patch/url_validation.php');

View File

@@ -148,10 +148,13 @@ function validate_payment_for_user_CIPF($user_id, $order_id) {
update_field($acf_card_expiration, $date_plus_one_year->format($acf_date_format), $acf_id); update_field($acf_card_expiration, $date_plus_one_year->format($acf_date_format), $acf_id);
/* /*
* change user profil to active * change user profil :
* - to active
* - card state is renewal
* *
*/ */
update_field($prof_is_activ, 'Actif', $acf_id); update_field($prof_is_activ, 'Actif', $acf_id);
update_field($acf_card_state, 'Renouvellement', $acf_id);
} }

View File

@@ -12,7 +12,7 @@ if (!defined('ABSPATH')) {
/* /*
* prevent users to fill the renew form if * prevent users to fill the renew form if
* they are not prof and logged in, * they are not prof and logged in,
* and if there card is not in renewable state * and if their card is not in renewable state
* except admins and editor * except admins and editor
* *
*/ */
@@ -54,16 +54,32 @@ function renew_page_restrictions_CIPF(){
add_action('template_redirect', 'renew_page_restrictions_CIPF'); add_action('template_redirect', 'renew_page_restrictions_CIPF');
/*
* #cipf_prof_carte_commande -> default display: block;
* #cipf_prof_carte_renouvellement -> default display: none;
*/
function renew_page_filter_message_CIPF(){ function renew_page_filter_message_CIPF(){
$slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD; $slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD;
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
if (!is_page($slug_renew_card)) if (!is_page($slug_renew_card))
return; return;
$user_id = get_current_user_id();
$acf_id = 'user_'.$user_id;
$cipf_renew = new PLGNTLS_class(); $cipf_renew = new PLGNTLS_class();
$cipf_prof_payement->add_to_front(array(
array( 'css' => '#cipf_prof_paiement_reussi {display: block;}' ) $card_state = get_field($acf_card_state, $acf_id);
)); error_log("card_state");
error_log($card_state);
if ($card_state === 'Renouvellement') {
$cipf_renew->add_to_front(array(
array( 'css' => 'div#cipf_prof_carte_renouvellement {display: block;}' ),
array( 'css' => 'div#cipf_prof_carte_commande {display: none;}' ),
));
}
} }
add_action('wp_enqueue_scripts', 'renew_page_filter_message_CIPF'); add_action('wp_enqueue_scripts', 'renew_page_filter_message_CIPF');

Submodule private updated: 0243fd7e20...a135dcbe03