new profs redirects to command

This commit is contained in:
asus
2024-03-20 14:44:19 +01:00
parent 0717a7d9e4
commit b93a3298d2
6 changed files with 34 additions and 8 deletions

View File

@@ -82,7 +82,7 @@ function restrict_admin_access_CIPF() {
*/
redirection_profil_CIPF();
}
add_action('init', 'restrict_admin_access_CIPF', 100);
//add_action('init', 'restrict_admin_access_CIPF', 100);

View File

@@ -71,14 +71,14 @@ add_action('df_after_process', 'prof_after_form_commande_CIPF', 10, 3);
*/
function prof_form_restrictions_CIPF(){
PLGNTLS_class::debug_infos();
$slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD;
$slug_command_card = PLGNTLS_class::SLUG_COMMAND_CARD;
$role_prof = PLGNTLS_class::ROLE_PROF;
// don't redirect if it is the divi builder mode
if (et_fb_is_enabled()) {
return;
}
if (!is_page($slug_renew_card)) {
if (!is_page($slug_command_card)) {
return;
}
@@ -103,9 +103,9 @@ add_action('template_redirect', 'prof_form_restrictions_CIPF');
*/
function renew_page_filter_message_CIPF(){
PLGNTLS_class::debug_infos();
$slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD;
$slug_command_card = PLGNTLS_class::SLUG_COMMAND_CARD;
if (!is_page($slug_renew_card))
if (!is_page($slug_command_card))
return;
$user_id = get_current_user_id();

View File

@@ -131,6 +131,14 @@ function prof_profil_redirects_CIPF() {
redirect_home_CIPF();
}
/*
* if connected prof is new, redirect to form commande
*
*/
if (is_account_new_CIPF()) {
redirect_command_CIPF();
}
}
add_action('template_redirect', 'prof_profil_redirects_CIPF', 11);

View File

@@ -27,6 +27,24 @@ function redirect_home_CIPF(){
/*
* redirects new prof to commande
*
*/
function redirect_command_CIPF(){
PLGNTLS_class::debug_infos();
$slug_command_card = PLGNTLS_class::SLUG_COMMAND_CARD;
// Set up nocache headers before redirecting : https://developer.wordpress.org/reference/functions/wp_safe_redirect/#user-contributed-notes
nocache_headers();
wp_redirect(home_url($slug_command_card), 301);
exit;
}
/*
* redirect users to profil
* if prof -> author page