Files
2024_WEBSITE_fipf/plugins/fipfcard_plugin/php/prof_check_page.php

35 lines
702 B
PHP

<?php
function check_prof_page_CIPF() {
//add_action('template_redirect', 'is_prof_activ_CIPF');
}
add_action('init', 'check_prof_page_CIPF');
function is_prof_activ_CIPF() {
$acf_prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV;
$slug_wait_activation = PLGNTLS_class::SLUG_PROF_INACTIV;
//$current_user = wp_get_current_user();
$user_id = get_current_user_id();
$acf_id = 'user_' . $user_id;
$is_activ = get_field($acf_prof_is_activ, $acf_id);
if (!empty($is_activ))
return;
$redirection_prof_inactiv = home_url() . '/' . $slug_wait_activation;
error_log("redirection_prof_inactiv");
error_log($redirection_prof_inactiv);
wp_redirect($redirection_prof_inactiv);
exit;
}
?>