60 lines
976 B
PHP
60 lines
976 B
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_class::debug_infos(2);
|
|
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
|
|
|
/*
|
|
* dont do anything if :
|
|
* - user not logged in
|
|
* - user no partner
|
|
* - partner not author of the page
|
|
*
|
|
*/
|
|
if (!is_user_logged_in()) {
|
|
return;
|
|
}
|
|
if (!current_user_can($role_partner)) {
|
|
return;
|
|
}
|
|
PLGNTLS_class::debug_infos();
|
|
global $post;
|
|
$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
|
|
*
|
|
*/
|
|
$cipf_partner = new PLGNTLS_class();
|
|
$cipf_partner->add_to_front(array('css/partner_page.css'));
|
|
}
|
|
add_action('wp_enqueue_scripts', 'partner_page_scripts_CIPF', 11);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|