- creates redirect-home function

- restrict prof form to profs
- restrict paypal page for prof only
This commit is contained in:
asus
2024-03-20 01:02:46 +01:00
parent 0127d8db4c
commit 33adb095e5
5 changed files with 70 additions and 38 deletions

View File

@@ -61,20 +61,27 @@ add_action('df_after_process', 'prof_after_form_CIPF', 10, 3);
/*
* redirections
* only profs can access this form
*
*/
function prof_form_restrictions_CIPF(){
PLGNTLS_class::debug_infos();
$slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD;
$role_prof = PLGNTLS_class::ROLE_PROF;
if (!is_page($slug_renew_card))
if (!is_page($slug_renew_card)) {
return;
}
$user_id = get_current_user_id();
// redirections here
/*
* if prof, don't redirect
* for everyone else, redirect
*
*/
if (current_user_can($role_prof)) {
return;
}
redirect_home_CIPF();
}
add_action('template_redirect', 'prof_form_restrictions_CIPF');