Files
2024_WEBSITE_fipf/plugins/cipf_plugin/php/partners_form.php
asus fb146ecda4 - updated states to work for user_id and post_id
- added states for partner page state publish-draft
2024-04-01 23:09:22 +02:00

67 lines
895 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!');
}
/*
* check if partner can access the form to create a new page
*
*/
function partner_form_creation_page_CIPF() {
Plgntls::debug_infos(2);
$role_partner = Plgntls::ROLE_PARTNER;
$slug_partner_create_page = Plgntls::SLUG_PARTNER_CREATE_PAGE;
/*
* only for the partner form creation page
*
*/
if (!is_page($slug_partner_create_page)) {
return;
}
Plgntls::debug_infos();
/*
* redirect anyone that is not a partner
*
*/
if (!is_user_logged_in()) {
redirect_home_CIPF();
}
if (!current_user_can($role_partner)) {
redirect_home_CIPF();
}
/*
* if a partner already has a page, redirect it
*
*/
redirection_profil_CIPF();
}
add_action('template_redirect', 'partner_form_creation_page_CIPF');
?>