- updated states to work for user_id and post_id

- added states for partner page state publish-draft
This commit is contained in:
asus
2024-04-01 23:09:22 +02:00
parent 4d7906be40
commit fb146ecda4
13 changed files with 354 additions and 60 deletions

View File

@@ -0,0 +1,66 @@
<?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');
?>