diff --git a/plugins/cipf_plugin/fipfcard_plugin.php b/plugins/cipf_plugin/fipfcard_plugin.php index a3e6441..7ce951b 100644 --- a/plugins/cipf_plugin/fipfcard_plugin.php +++ b/plugins/cipf_plugin/fipfcard_plugin.php @@ -1,6 +1,6 @@ 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($acf_card_state, 'Renouvellement', $acf_id); } diff --git a/plugins/cipf_plugin/php/renew_card.php b/plugins/cipf_plugin/php/renew_card.php index e1fac84..b72553e 100644 --- a/plugins/cipf_plugin/php/renew_card.php +++ b/plugins/cipf_plugin/php/renew_card.php @@ -12,7 +12,7 @@ if (!defined('ABSPATH')) { /* * prevent users to fill the renew form if * 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 * */ @@ -54,16 +54,32 @@ function 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(){ $slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD; + $acf_card_state = PLGNTLS_class::ACF_CARD_STATE; + if (!is_page($slug_renew_card)) return; + $user_id = get_current_user_id(); + $acf_id = 'user_'.$user_id; + $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'); diff --git a/private b/private index 0243fd7..a135dcb 160000 --- a/private +++ b/private @@ -1 +1 @@ -Subproject commit 0243fd7e20aa7aed83e1c14ef15f5ae007a1fded +Subproject commit a135dcbe03376cbc3412f2ca921a1457bcf29ebd diff --git a/wordpress_docker b/wordpress_docker index 82e6509..3181248 160000 --- a/wordpress_docker +++ b/wordpress_docker @@ -1 +1 @@ -Subproject commit 82e65092cf4c51318b8bff46384efbacce88e794 +Subproject commit 3181248be9b7f2b16d607b2bbb21a959cd7adc4f