new profs redirects to command
This commit is contained in:
@@ -4,7 +4,7 @@ Plugin Name: cipf_plugin
|
||||
Plugin URI:
|
||||
Description:
|
||||
Author: hugogogo
|
||||
Version: 0.3.9
|
||||
Version: 0.3.10.1
|
||||
Author URI:
|
||||
*/
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -79,7 +79,7 @@ class PLGNTLS_class {
|
||||
|
||||
// SLUG
|
||||
const SLUG_PROF_INACTIV = 'validation-en-cours';
|
||||
const SLUG_RENEW_CARD = 'commande';
|
||||
const SLUG_COMMAND_CARD = 'commande';
|
||||
const SLUG_PAGE_REDIRECTION = 'redirection_cipf';
|
||||
const SLUG_PAYPAL_PAGE = 'paiement';
|
||||
const SLUG_PAYPAL_REDIRECTION_SUCCESS = self::SLUG_PAGE_REDIRECTION;
|
||||
@@ -132,7 +132,7 @@ class PLGNTLS_class {
|
||||
const ADMIN_VALIDATE_PROF_FIELD = 'admin_activate_prof_cipf'; // for admin_modif_prof.php
|
||||
|
||||
|
||||
private static $_DEBUG_INFOS = false;
|
||||
private static $_DEBUG_INFOS = true;
|
||||
private static $_plugin_dir_path;
|
||||
private static $_plugin_name;
|
||||
private static $_file_dir_path;
|
||||
|
||||
Reference in New Issue
Block a user