wip debug redirections
This commit is contained in:
@@ -15,8 +15,17 @@ function restrict_author_page_CIPF() {
|
||||
$role_fipf = PLGNTLS_class::ROLE_FIPF;
|
||||
$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())
|
||||
return;
|
||||
PLGNTLS_class::debug_infos();
|
||||
|
||||
$current_user = wp_get_current_user();
|
||||
|
||||
@@ -29,6 +38,7 @@ function restrict_author_page_CIPF() {
|
||||
$allowed_roles = array($role_admin, $role_fipf);
|
||||
if (array_intersect($allowed_roles, $current_user->roles))
|
||||
return;
|
||||
PLGNTLS_class::debug_infos();
|
||||
|
||||
/*
|
||||
* get_queried_object_id() would work too
|
||||
@@ -46,6 +56,7 @@ function restrict_author_page_CIPF() {
|
||||
wp_redirect(home_url(), 301);
|
||||
exit;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
}
|
||||
add_action('template_redirect', 'restrict_author_page_CIPF', 10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user