redirections whould work now
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
/*
|
||||
Plugin Name: cipf_plugin
|
||||
Plugin URI:
|
||||
Description:
|
||||
Description: reset cgv, price works with acf label
|
||||
Author: hugogogo
|
||||
Version: 0.2.9
|
||||
Version: 0.3.1
|
||||
Author URI:
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,6 @@ include_once(PLGNTLS_class::root_path() . 'php/redirections.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/author_restriction.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/profs_profil.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/profs_form.php');
|
||||
//include_once(PLGNTLS_class::root_path() . 'php/reset_card_form.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/partners_register.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/partners_page.php');
|
||||
|
||||
|
||||
@@ -26,17 +26,22 @@ function redirection_profil_CIPF(){
|
||||
// Set up nocache headers before redirecting : https://developer.wordpress.org/reference/functions/wp_safe_redirect/#user-contributed-notes
|
||||
nocache_headers();
|
||||
|
||||
error_log("- in redirection_profil_CIPF");
|
||||
|
||||
if (!is_user_logged_in()) {
|
||||
error_log("user not logged in");
|
||||
wp_redirect($base_url, 301);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (current_user_can($role_prof)) {
|
||||
error_log("user is prof");
|
||||
$user_page = get_author_posts_url($current_user_id);
|
||||
wp_redirect($user_page, 301);
|
||||
exit;
|
||||
}
|
||||
else if (current_user_can($role_partner)) {
|
||||
error_log("user is partner");
|
||||
$args = array(
|
||||
'post_type' => 'post',
|
||||
'author' => $current_user_id,
|
||||
@@ -55,6 +60,7 @@ function redirection_profil_CIPF(){
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
error_log("else");
|
||||
wp_redirect($base_url, 301);
|
||||
exit;
|
||||
}
|
||||
@@ -65,16 +71,20 @@ function redirection_profil_CIPF(){
|
||||
|
||||
|
||||
/*
|
||||
* version 1:
|
||||
* redirects when on the page with slug defined in SLUG_PAGE_REDIRECTION
|
||||
* version 3:
|
||||
* redirects when trying to access the page with SLUG_PAGE_REDIRECTION
|
||||
* no matter if it exists or not
|
||||
*
|
||||
*/
|
||||
function redirection_page_CIPF(){
|
||||
PLGNTLS_class::debug_infos();
|
||||
$slug_page_redirection = PLGNTLS_class::SLUG_PAGE_REDIRECTION;
|
||||
|
||||
if (!is_page($slug_page_redirection))
|
||||
global $wp;
|
||||
$current_slug = $wp->request;
|
||||
if ($current_slug !== $slug_page_redirection) {
|
||||
return;
|
||||
}
|
||||
|
||||
redirection_profil_CIPF();
|
||||
}
|
||||
@@ -84,6 +94,27 @@ add_action('template_redirect', 'redirection_page_CIPF');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* version 1:
|
||||
* redirects when on the page with slug defined in SLUG_PAGE_REDIRECTION
|
||||
*
|
||||
*/
|
||||
//function redirection_page_CIPF(){
|
||||
// PLGNTLS_class::debug_infos();
|
||||
// $slug_page_redirection = PLGNTLS_class::SLUG_PAGE_REDIRECTION;
|
||||
//
|
||||
// if (!is_page($slug_page_redirection)) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// redirection_profil_CIPF();
|
||||
//}
|
||||
//add_action('template_redirect', 'redirection_page_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* version 2:
|
||||
* redirects when a specific url is requested : SLUG_PAGE_REDIRECTION
|
||||
|
||||
@@ -77,6 +77,7 @@ function output_list_front($array, $current_user, $user_id) {
|
||||
function current_user_infos($atts) {
|
||||
$is_important = false;
|
||||
|
||||
|
||||
/*
|
||||
* choose the default id target :
|
||||
* - logged_in
|
||||
|
||||
Reference in New Issue
Block a user