changed meta field payment_status for acf field
This commit is contained in:
@@ -52,16 +52,17 @@ function handle_prof_is_activ_CIPF($author_id) {
|
||||
|
||||
|
||||
/*
|
||||
* check meta field META_PAYEMENT_STATUS
|
||||
* check acf field payment_status
|
||||
* if field value is 'success'
|
||||
* - hide block 'failure'
|
||||
* - and update field to '', so it will not show next time
|
||||
* - show block 'failure'
|
||||
* - and update field to 'nothing', so it will not show next time
|
||||
* if field value is 'failure'
|
||||
* - show bloc success
|
||||
* - and update field to 'nothing', so it will not show next time
|
||||
* if field value is 'nothing'
|
||||
* - do nothing (keep blocs hidden)
|
||||
* if field value is 'started'
|
||||
* - hide bloc success
|
||||
* (we assume it means the order didn't go well)
|
||||
* (it does not really makes sens, but ok for the moment)
|
||||
* if field value is ''
|
||||
* - hide both 'success' and 'failure' blocs
|
||||
* - do nothing (keep blocs hidden)
|
||||
*
|
||||
* .cipf_prof_paiement_message -> on row, added display none in page css
|
||||
* #cipf_prof_paiement_reussi -> on row
|
||||
@@ -71,13 +72,15 @@ function handle_prof_is_activ_CIPF($author_id) {
|
||||
function show_prof_paiement_messages_CIPF($user_id) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV;
|
||||
$meta_payement_status = PLGNTLS_class::META_PAYEMENT_STATUS;
|
||||
//$meta_payement_status = PLGNTLS_class::META_PAYEMENT_STATUS;
|
||||
$acf_payment_status = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
|
||||
|
||||
$acf_id = 'user_' . $user_id;
|
||||
|
||||
/*
|
||||
* if prof is inactive, do nothing more
|
||||
*
|
||||
*/
|
||||
$acf_id = 'user_' . $user_id;
|
||||
$is_activ = get_field($acf_prof_is_activ['_name'], $acf_id);
|
||||
if (is_null($is_activ) || empty($is_activ))
|
||||
return;
|
||||
@@ -86,19 +89,23 @@ function show_prof_paiement_messages_CIPF($user_id) {
|
||||
|
||||
$cipf_prof_payement = new PLGNTLS_class();
|
||||
|
||||
$payement_status = get_user_meta($user_id, $meta_payement_status, true);
|
||||
if ($payement_status === 'success') {
|
||||
//$payement_status = get_user_meta($user_id, $meta_payement_status, true);
|
||||
$payement_status = get_field($acf_payment_status['_name'], $acf_id);
|
||||
//if ($payement_status === 'success') {
|
||||
if ($payement_status === $acf_payment_status['success']) {
|
||||
$cipf_prof_payement->add_to_front(array(
|
||||
array( 'css' => '#cipf_prof_paiement_reussi {display: block;}' )
|
||||
));
|
||||
}
|
||||
else if ($payement_status === 'started') {
|
||||
//else if ($payement_status === 'started') {
|
||||
else if ($payement_status === $acf_payment_status['failure']) {
|
||||
$cipf_prof_payement->add_to_front(array(
|
||||
array( 'css' => '#cipf_prof_paiement_echoue {display: block;}' )
|
||||
));
|
||||
}
|
||||
|
||||
update_user_meta($user_id, $meta_payement_status, '');
|
||||
//update_user_meta($user_id, $meta_payement_status, '');
|
||||
update_field($acf_payment_status['_name'], $acf_payment_status['nothing'], $acf_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user