created functions to handle all state changes
This commit is contained in:
@@ -15,7 +15,7 @@ if (!defined('ABSPATH')) {
|
||||
* actions after prof form is validated
|
||||
*
|
||||
*/
|
||||
function prof_form_reset_fields_CIPF($form_id, $post_array, $form_type) {
|
||||
function prof_after_form_CIPF($form_id, $post_array, $form_type) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_cgv = PLGNTLS_class::ACF_PROF_CGV;
|
||||
$acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE;
|
||||
@@ -32,15 +32,21 @@ function prof_form_reset_fields_CIPF($form_id, $post_array, $form_type) {
|
||||
|
||||
|
||||
/*
|
||||
* if new prof, change status to 'to pay'
|
||||
* change status to :
|
||||
* if new prof & paypal : 'to pay'
|
||||
* if expired card & paypal : 'to_pay'
|
||||
*
|
||||
*/
|
||||
$is_new = get_field($acf_account_state['_name'], $acf_id);
|
||||
if ($is_new === $acf_account_state['new']) {
|
||||
update_field($acf_account_state['_name'], $acf_account_state['to_pay'], $acf_id);
|
||||
if (is_payment_method_paypal_CIPF()) {
|
||||
if (is_account_new_CIPF()) {
|
||||
set_account_to_pay_CIPF();
|
||||
}
|
||||
if (is_account_expired_CIPF()) {
|
||||
set_account_to_pay_CIPF();
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('df_after_process', 'prof_form_reset_fields_CIPF', 10, 3);
|
||||
add_action('df_after_process', 'prof_after_form_CIPF', 10, 3);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user