- creates redirect-home function
- restrict prof form to profs - restrict paypal page for prof only
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user