Files
2024_WEBSITE_fipf/plugins/cipf_plugin/php/partners_page.php
2024-03-31 20:53:26 +02:00

68 lines
1.0 KiB
PHP

<?php
/*
* it means someone outside wp is accessing the file, in this case kill it.
*/
if (!defined('ABSPATH')) {
die('You can not access this file!');
}
/*
* upload scripts and styles on partner page
*
*/
function partner_page_scripts_CIPF() {
Plgntls::debug_infos(2);
$role_partner = Plgntls::ROLE_PARTNER;
if (!is_single()) {
return;
}
/*
* if on post, load css to hide partner own stuff
*
*/
Plgntls::add_to_front(array('css/partner_page.css'));
/*
* then check if is partner own page
*
*/
if (!is_user_logged_in()) {
return;
}
if (!current_user_can($role_partner)) {
return;
}
global $post;
if (is_null($post)) {
return;
}
Plgntls::debug_infos();
$current_post_author = (int)($post->post_author);
$current_user_id = (int)get_current_user_id();
if ($current_user_id !== $current_post_author) {
return;
}
/*
* on partner own page, load css to show own stuff
*
*/
Plgntls::add_to_front(array('css/partner_page_own.css'));
}
add_action('wp_enqueue_scripts', 'partner_page_scripts_CIPF', 11);
?>