Files
2024_WEBSITE_fipf/plugins/fipfcard_plugin/php/author_restriction.php
asus b8fbd84d53 - payment : first date error corrected
- payment : added httpErrorException
- payment : error handling wip
- profil page restriction gives access to admin and editor
2024-03-07 10:26:11 +01:00

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');
?>