v 0.3.10 admin can validate payment from front
This commit is contained in:
@@ -46,7 +46,7 @@ function payment_page_redirects_CIPF() {
|
||||
$role_prof = PLGNTLS_class::ROLE_PROF;
|
||||
|
||||
// don't redirect if it is the divi builder mode
|
||||
if (et_fb_is_enabled) {
|
||||
if (et_fb_is_enabled()) {
|
||||
return;
|
||||
}
|
||||
// check the slug
|
||||
|
||||
@@ -12,15 +12,17 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
/*
|
||||
* actions after prof form is validated
|
||||
* actions after prof form commande is validated
|
||||
*
|
||||
*/
|
||||
function prof_after_form_CIPF($form_id, $post_array, $form_type) {
|
||||
function prof_after_form_commande_CIPF($form_id, $post_array, $form_type) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE;
|
||||
error_log('form_id: '.json_encode($form_id));
|
||||
error_log('post_array: '.json_encode($post_array));
|
||||
error_log('form_type: '.json_encode($form_type));
|
||||
$form_prof_commande_id = PLGNTLS_class::FORM_PROF_COMMANDE_ID;
|
||||
|
||||
if ($form_prof_commande_id !== $form_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
//$user_id = get_current_user_id();
|
||||
$user_id = $post_array['ID'];
|
||||
@@ -58,7 +60,7 @@ error_log('form_type: '.json_encode($form_type));
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('df_after_process', 'prof_after_form_CIPF', 10, 3);
|
||||
add_action('df_after_process', 'prof_after_form_commande_CIPF', 10, 3);
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +75,7 @@ function prof_form_restrictions_CIPF(){
|
||||
$role_prof = PLGNTLS_class::ROLE_PROF;
|
||||
|
||||
// don't redirect if it is the divi builder mode
|
||||
if (et_fb_is_enabled) {
|
||||
if (et_fb_is_enabled()) {
|
||||
return;
|
||||
}
|
||||
if (!is_page($slug_renew_card)) {
|
||||
@@ -10,6 +10,39 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* actions after prof form transfert validation is processed
|
||||
*
|
||||
*/
|
||||
function prof_after_form_transfert_validation_CIPF($form_id, $post_array, $form_type) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE;
|
||||
$form_prof_transfert_id = PLGNTLS_class::FORM_PROF_TRANSFERT_ID;
|
||||
|
||||
if ($form_prof_transfert_id !== $form_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
//$user_id = get_current_user_id();
|
||||
$user_id = $post_array['ID'];
|
||||
|
||||
|
||||
/*
|
||||
* when transfert is validate, change card to valid
|
||||
*
|
||||
*/
|
||||
if (is_transfert_success_CIPF($user_id)) {
|
||||
set_account_valid_CIPF($user_id);
|
||||
}
|
||||
}
|
||||
add_action('df_after_process', 'prof_after_form_transfert_validation_CIPF', 10, 3);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* early checks on profil page
|
||||
*
|
||||
@@ -60,7 +93,7 @@ function prof_profil_redirects_CIPF() {
|
||||
if (!is_author())
|
||||
return;
|
||||
// don't redirect if it is the divi builder mode
|
||||
if (et_fb_is_enabled) {
|
||||
if (et_fb_is_enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,9 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
* [/] numero de carte ('numero_de_la_carte') -> ok 1/1 : [1: after payment & card is 'commande' - ok]
|
||||
*
|
||||
* [ ] cgv
|
||||
* [/] cgv
|
||||
*
|
||||
* [/] etat_virement -> ko 0/2 : [1: at form validation - ko], [2: check on profil page - ko]
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -357,4 +358,39 @@ function reset_acf_cgv_CIPF($user_id = null) {
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* etat virement
|
||||
*
|
||||
*/
|
||||
function is_transfert_success_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_transfert_state = PLGNTLS_class::ACF_TRANSFERT_STATE;
|
||||
|
||||
if (is_null($user_id)) {
|
||||
$user_id = get_current_user_id();
|
||||
}
|
||||
$acf_id = 'user_'.$user_id;
|
||||
$transfert_state = get_field($acf_transfert_state['_name'], $acf_id);
|
||||
|
||||
/*
|
||||
* before first use : returns null
|
||||
* if checked : returns value
|
||||
* if unchecked : returns empty
|
||||
*/
|
||||
if (empty($transfert_state)) {
|
||||
return false;
|
||||
}
|
||||
if (is_null($transfert_state)) {
|
||||
return false;
|
||||
}
|
||||
if (reset($transfert_state) === $acf_transfert_state['success']) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user