wip debug redirections

This commit is contained in:
asus
2024-03-14 12:31:31 +01:00
parent ecc072e25b
commit 76f2e8ba00
14 changed files with 165 additions and 29 deletions

View File

@@ -32,15 +32,32 @@ function renew_page_restrictions_CIPF(){
$base_url = home_url();
if (!is_page($slug_renew_card))
return;
wp_reset_query();
$slug = get_post_field( 'post_name', get_post() );
error_log("slug");
error_log($slug);
// error_log("request");
// error_log(json_encode($_REQUEST));
// error_log("server");
// error_log(json_encode($_SERVER));
if (!is_page('commande'))
return;
PLGNTLS_class::debug_infos();
/*
* is it good ?
* -> dont' redirect if user not logged in, because new users need to acces this page
*
if (!is_user_logged_in()) {
// Set up nocache headers before redirecting : https://developer.wordpress.org/reference/functions/wp_safe_redirect/#user-contributed-notes
nocache_headers();
wp_redirect($base_url, 301);
exit;
}
*/
$current_user_id = get_current_user_id();
$current_user = wp_get_current_user();
@@ -51,10 +68,10 @@ function renew_page_restrictions_CIPF(){
* check multiple user roles
* https://developer.wordpress.org/reference/functions/current_user_can/#div-comment-4083
*
*/
$allowed_roles = array($role_admin, $role_fipf, $role_prof);
if (!array_intersect($allowed_roles, $current_user->roles))
return;
*/
/*
* if prof, check card state
@@ -93,8 +110,15 @@ function renew_page_filter_message_CIPF(){
$slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD;
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
$slug = get_post_field( 'post_name', get_post() );
error_log("slug");
error_log($slug);
/*
if (!is_page($slug_renew_card))
return;
*/
PLGNTLS_class::debug_infos();
$user_id = get_current_user_id();
$acf_id = 'user_'.$user_id;