- reset cgv
- price works with all acf returns for radio buttons
- redirection works
This commit is contained in:
asus
2024-03-17 18:16:28 +01:00
parent 874736fd8a
commit fcb15c97d1
2 changed files with 3 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
/* /*
Plugin Name: cipf_plugin Plugin Name: cipf_plugin
Plugin URI: Plugin URI:
Description: reset cgv, price works with acf label Description:
Author: hugogogo Author: hugogogo
Version: 0.3.1 Version: 0.3.1
Author URI: Author URI:

View File

@@ -26,22 +26,17 @@ function redirection_profil_CIPF(){
// Set up nocache headers before redirecting : https://developer.wordpress.org/reference/functions/wp_safe_redirect/#user-contributed-notes // Set up nocache headers before redirecting : https://developer.wordpress.org/reference/functions/wp_safe_redirect/#user-contributed-notes
nocache_headers(); nocache_headers();
error_log("- in redirection_profil_CIPF");
if (!is_user_logged_in()) { if (!is_user_logged_in()) {
error_log("user not logged in");
wp_redirect($base_url, 301); wp_redirect($base_url, 301);
exit; exit;
} }
if (current_user_can($role_prof)) { if (current_user_can($role_prof)) {
error_log("user is prof");
$user_page = get_author_posts_url($current_user_id); $user_page = get_author_posts_url($current_user_id);
wp_redirect($user_page, 301); wp_redirect($user_page, 301);
exit; exit;
} }
else if (current_user_can($role_partner)) { else if (current_user_can($role_partner)) {
error_log("user is partner");
$args = array( $args = array(
'post_type' => 'post', 'post_type' => 'post',
'author' => $current_user_id, 'author' => $current_user_id,
@@ -60,7 +55,6 @@ error_log("user is partner");
exit; exit;
} }
else { else {
error_log("else");
wp_redirect($base_url, 301); wp_redirect($base_url, 301);
exit; exit;
} }
@@ -71,7 +65,7 @@ error_log("else");
/* /*
* version 3: * version 4:
* redirects when trying to access the page with SLUG_PAGE_REDIRECTION * redirects when trying to access the page with SLUG_PAGE_REDIRECTION
* no matter if it exists or not * no matter if it exists or not
* *
@@ -156,6 +150,7 @@ add_action('template_redirect', 'redirection_page_CIPF');
/* /*
* version 3:
* DOES NOT WORK so far * DOES NOT WORK so far
* because to use is_user_logged_in() in redirection_profil_CIPF * because to use is_user_logged_in() in redirection_profil_CIPF
* the request should include the X-WP-Nonce header, but it does not * the request should include the X-WP-Nonce header, but it does not