- payment : added httpErrorException - payment : error handling wip - profil page restriction gives access to admin and editor
31 lines
527 B
PHP
31 lines
527 B
PHP
<?php
|
|
|
|
|
|
|
|
function restrict_author_page_CIPF() {
|
|
$can_access = false;
|
|
if (is_author())
|
|
$can_access = true;
|
|
else if (current_user_can('administrator'))
|
|
$can_access = true;
|
|
else if (current_user_can('editor'))
|
|
$can_access = true;
|
|
|
|
if ($can_access === false)
|
|
return;
|
|
|
|
global $post;
|
|
$author_id = get_the_author_meta( 'ID' );
|
|
$current_user_id = get_current_user_id();
|
|
|
|
if ($current_user_id != $author_id) {
|
|
wp_redirect(home_url());
|
|
exit;
|
|
}
|
|
}
|
|
add_action('template_redirect', 'restrict_author_page_CIPF');
|
|
|
|
|
|
|
|
?>
|