wip i broke everyhting :p
This commit is contained in:
@@ -15,17 +15,8 @@ function restrict_author_page_CIPF() {
|
|||||||
$role_fipf = PLGNTLS_class::ROLE_FIPF;
|
$role_fipf = PLGNTLS_class::ROLE_FIPF;
|
||||||
$role_admin = PLGNTLS_class::ROLE_ADMIN;
|
$role_admin = PLGNTLS_class::ROLE_ADMIN;
|
||||||
|
|
||||||
$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_author())
|
if (!is_author())
|
||||||
return;
|
return;
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
|
|
||||||
$current_user = wp_get_current_user();
|
$current_user = wp_get_current_user();
|
||||||
|
|
||||||
@@ -38,7 +29,6 @@ PLGNTLS_class::debug_infos();
|
|||||||
$allowed_roles = array($role_admin, $role_fipf);
|
$allowed_roles = array($role_admin, $role_fipf);
|
||||||
if (array_intersect($allowed_roles, $current_user->roles))
|
if (array_intersect($allowed_roles, $current_user->roles))
|
||||||
return;
|
return;
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_queried_object_id() would work too
|
* get_queried_object_id() would work too
|
||||||
@@ -56,7 +46,6 @@ PLGNTLS_class::debug_infos();
|
|||||||
wp_redirect(home_url(), 301);
|
wp_redirect(home_url(), 301);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
}
|
}
|
||||||
add_action('template_redirect', 'restrict_author_page_CIPF', 10);
|
add_action('template_redirect', 'restrict_author_page_CIPF', 10);
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,6 @@ function hide_admin_bar_CIPF() {
|
|||||||
PLGNTLS_class::debug_infos();
|
PLGNTLS_class::debug_infos();
|
||||||
$role_admin = PLGNTLS_class::ROLE_ADMIN;
|
$role_admin = PLGNTLS_class::ROLE_ADMIN;
|
||||||
|
|
||||||
$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 (!current_user_can($role_admin) && !is_admin()) {
|
if (!current_user_can($role_admin) && !is_admin()) {
|
||||||
show_admin_bar(false);
|
show_admin_bar(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,23 +115,16 @@ function show_prof_paiement_messages_CIPF($user_id) {
|
|||||||
function check_prof_page_CIPF() {
|
function check_prof_page_CIPF() {
|
||||||
PLGNTLS_class::debug_infos();
|
PLGNTLS_class::debug_infos();
|
||||||
|
|
||||||
$slug = get_post_field( 'post_name', get_post() );
|
|
||||||
error_log("slug");
|
|
||||||
error_log($slug);
|
|
||||||
|
|
||||||
// is an author page
|
// is an author page
|
||||||
if (!is_author())
|
if (!is_author())
|
||||||
return;
|
return;
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
|
|
||||||
// the way to find the id of the author of an author_page
|
// the way to find the id of the author of an author_page
|
||||||
$author_id = get_queried_object_id();
|
$author_id = get_queried_object_id();
|
||||||
|
|
||||||
handle_prof_is_activ_CIPF($author_id);
|
handle_prof_is_activ_CIPF($author_id);
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
|
|
||||||
show_prof_paiement_messages_CIPF($author_id);
|
show_prof_paiement_messages_CIPF($author_id);
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
add_action('template_redirect', 'check_prof_page_CIPF', 11);
|
add_action('template_redirect', 'check_prof_page_CIPF', 11);
|
||||||
|
|||||||
@@ -21,28 +21,21 @@ function redirection_profil_page_CIPF(){
|
|||||||
|
|
||||||
$base_url = home_url();
|
$base_url = home_url();
|
||||||
$current_user_id = get_current_user_id();
|
$current_user_id = get_current_user_id();
|
||||||
|
|
||||||
// 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("--- inside redirection profil page");
|
|
||||||
if (!is_user_logged_in()) {
|
if (!is_user_logged_in()) {
|
||||||
foreach ($_COOKIE as $name => $value) {
|
|
||||||
error_log(json_encode("$name: $value"));
|
|
||||||
}
|
|
||||||
|
|
||||||
error_log("is 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("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("is partenaire");
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => 'post',
|
'post_type' => 'post',
|
||||||
'author' => $current_user_id,
|
'author' => $current_user_id,
|
||||||
@@ -60,7 +53,6 @@ function redirection_profil_page_CIPF(){
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error_log("is else");
|
|
||||||
wp_redirect($base_url, 301);
|
wp_redirect($base_url, 301);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -76,72 +68,39 @@ function redirection_profil_page_CIPF(){
|
|||||||
*/
|
*/
|
||||||
function redirection_page_CIPF(){
|
function redirection_page_CIPF(){
|
||||||
PLGNTLS_class::debug_infos();
|
PLGNTLS_class::debug_infos();
|
||||||
|
error_log("hello");
|
||||||
$slug_page_redirection = PLGNTLS_class::SLUG_PAGE_REDIRECTION;
|
$slug_page_redirection = PLGNTLS_class::SLUG_PAGE_REDIRECTION;
|
||||||
|
|
||||||
$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($slug_page_redirection))
|
if (!is_page($slug_page_redirection))
|
||||||
return;
|
return;
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
|
|
||||||
redirection_profil_page_CIPF();
|
redirection_profil_page_CIPF();
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
}
|
}
|
||||||
add_action('template_redirect', 'redirection_page_CIPF');
|
add_action('template_redirect', 'redirection_page_CIPF');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* redirects when someone reaches the page with query ?QUERY_REDIRECTION_PROFIL
|
||||||
|
*
|
||||||
|
function redirection_query_CIPF() {
|
||||||
|
PLGNTLS_class::debug_infos();
|
||||||
|
$query_redirection = PLGNTLS_class::QUERY_REDIRECTION_PROFIL;
|
||||||
|
|
||||||
[ ] -debug: function 'hide_admin_bar_CIPF' (in /home/www-data/cipf_plugin/php/hide_admin.php, line 18)
|
// Check if the request contains ?QUERY_REDIRECTION_PROFIL
|
||||||
slug
|
if(isset($_GET[$query_redirection])) {
|
||||||
|
redirection_profil_page_CIPF();
|
||||||
[ ] -debug: function 'redirection_page_CIPF' (in /home/www-data/cipf_plugin/php/redirections.php, line 78)
|
}
|
||||||
slug
|
}
|
||||||
home
|
add_action('init', 'redirection_query_CIPF');
|
||||||
[ ] -debug: function 'restrict_author_page_CIPF' (in /home/www-data/cipf_plugin/php/author_restriction.php, line 14)
|
|
||||||
slug
|
|
||||||
home
|
|
||||||
[ ] -debug: function 'renew_page_restrictions_CIPF' (in /home/www-data/cipf_plugin/php/renew_card.php, line 26)
|
|
||||||
slug
|
|
||||||
home
|
|
||||||
[ ] -debug: function 'check_prof_page_CIPF' (in /home/www-data/cipf_plugin/php/prof_check_page.php, line 116)
|
|
||||||
slug
|
|
||||||
home
|
|
||||||
[ ] -debug: function 'renew_page_filter_message_CIPF' (in /home/www-data/cipf_plugin/php/renew_card.php, line 109)
|
|
||||||
slug
|
|
||||||
home
|
|
||||||
[ ] -debug: function 'hide_admin_bar_CIPF' (in /home/www-data/cipf_plugin/php/hide_admin.php, line 18)
|
|
||||||
slug
|
|
||||||
|
|
||||||
[ ] -debug: function 'redirection_page_CIPF' (in /home/www-data/cipf_plugin/php/redirections.php, line 78)
|
|
||||||
slug
|
|
||||||
calculations
|
|
||||||
[ ] -debug: function 'restrict_author_page_CIPF' (in /home/www-data/cipf_plugin/php/author_restriction.php, line 14)
|
|
||||||
slug
|
|
||||||
calculations
|
|
||||||
[ ] -debug: function 'renew_page_restrictions_CIPF' (in /home/www-data/cipf_plugin/php/renew_card.php, line 26)
|
|
||||||
slug
|
|
||||||
calculations
|
|
||||||
[ ] -debug: function 'check_prof_page_CIPF' (in /home/www-data/cipf_plugin/php/prof_check_page.php, line 116)
|
|
||||||
slug
|
|
||||||
calculations
|
|
||||||
[ ] -debug: function 'renew_page_filter_message_CIPF' (in /home/www-data/cipf_plugin/php/renew_card.php, line 109)
|
|
||||||
slug
|
|
||||||
calculations
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DOES NOT WORK so far
|
* DOES NOT WORK so far
|
||||||
* because to use is_user_logged_in() in redirection_profil_page_CIPF
|
* because to use is_user_logged_in() in redirection_profil_page_CIPF
|
||||||
@@ -166,23 +125,4 @@ add_action('rest_api_init', 'endpoint_for_redirection_CIPF');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
function custom_link_intercept() {
|
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
$query_page_redirection = PLGNTLS_class::QUERY_REDIRECTION_PROFIL;
|
|
||||||
|
|
||||||
// Check if the request contains ?QUERY_REDIRECTION_PROFIL
|
|
||||||
if(isset($_GET[$query_page_redirection])) {
|
|
||||||
redirection_profil_page_CIPF();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add_action('init', 'custom_link_intercept');
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -34,18 +34,8 @@ function renew_page_restrictions_CIPF(){
|
|||||||
|
|
||||||
wp_reset_query();
|
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'))
|
if (!is_page('commande'))
|
||||||
return;
|
return;
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* is it good ?
|
* is it good ?
|
||||||
@@ -110,15 +100,8 @@ function renew_page_filter_message_CIPF(){
|
|||||||
$slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD;
|
$slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD;
|
||||||
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
|
$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))
|
if (!is_page($slug_renew_card))
|
||||||
return;
|
return;
|
||||||
*/
|
|
||||||
PLGNTLS_class::debug_infos();
|
|
||||||
|
|
||||||
$user_id = get_current_user_id();
|
$user_id = get_current_user_id();
|
||||||
$acf_id = 'user_'.$user_id;
|
$acf_id = 'user_'.$user_id;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class PLGNTLS_class
|
|||||||
const SLUG_PAYPAL_REDIRECTION_FAILURE = '?'.self::QUERY_REDIRECTION_PROFIL;
|
const SLUG_PAYPAL_REDIRECTION_FAILURE = '?'.self::QUERY_REDIRECTION_PROFIL;
|
||||||
const URL_BASE_REST_ROUTE = 'cipf_plugin/api/v1'; // for routes, in php/paypal/routes.php && php/admin_modif_prof.php
|
const URL_BASE_REST_ROUTE = 'cipf_plugin/api/v1'; // for routes, in php/paypal/routes.php && php/admin_modif_prof.php
|
||||||
const QUERY_REDIRECTION_PROFIL = 'redirection_cipf';
|
const QUERY_REDIRECTION_PROFIL = 'redirection_cipf';
|
||||||
const QUERY_ADMIN_VALIDATE_PROF = 'admin_activate_prof_cipf'; // for admin_modif_prof.php
|
const QUERY_ADMIN_VALIDATE_PROF = 'admin_activate_prof_cipf'; // for admin_modif_prof.php
|
||||||
|
|
||||||
// PAYPAL
|
// PAYPAL
|
||||||
const PAYPAL_CLIENT_ID = "AfcmwxIXlG2ZxaMdjazX57I70BXz__aEqNWaTnqfSCI34a0V7nMbytswx7EViUjlpHs7opyrRwaH9YLl";
|
const PAYPAL_CLIENT_ID = "AfcmwxIXlG2ZxaMdjazX57I70BXz__aEqNWaTnqfSCI34a0V7nMbytswx7EViUjlpHs7opyrRwaH9YLl";
|
||||||
|
|||||||
2
private
2
private
Submodule private updated: e9929b6f8f...a86a33b46e
Reference in New Issue
Block a user