wip prof check page now handle the success message on paiement
This commit is contained in:
@@ -50,6 +50,54 @@ function handle_prof_is_activ_CIPF($author_id) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* check meta field 'fipf_payement_status'
|
||||
* if field value is 'success'
|
||||
* - hide block 'failure'
|
||||
* - and update field to '', so it will not show next time
|
||||
* 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
|
||||
*
|
||||
* .fipf_prof_paiement_message -> on row, added display none in page css
|
||||
* #fipf_prof_paiement_reussi -> on row
|
||||
* #fipf_prof_paiement_echoue -> on row
|
||||
*
|
||||
*/
|
||||
function show_prof_paiement_messages_CIPF($user_id) {
|
||||
/*
|
||||
* if prof is inactive, do nothing more
|
||||
*
|
||||
*/
|
||||
$acf_prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV;
|
||||
$acf_id = 'user_' . $user_id;
|
||||
$is_activ = get_field($acf_prof_is_activ, $acf_id);
|
||||
if (is_null($is_activ) || empty($is_activ))
|
||||
return;
|
||||
if ($is_activ === 'Inactif')
|
||||
return;
|
||||
|
||||
$fipf_prof_payement = new PLGNTLS_class();
|
||||
|
||||
$payement_status2 = get_user_meta($user_id, 'fipf_payement_status');
|
||||
$payement_status = get_user_meta($user_id, 'fipf_payement_status', true);
|
||||
if ($payement_status === 'success') {
|
||||
$fipf_prof_payement->add_to_front(array(
|
||||
array( 'css' => '#fipf_prof_paiement_reussi {display: block;}' )
|
||||
));
|
||||
}
|
||||
else if ($payement_status === 'started') {
|
||||
$fipf_prof_payement->add_to_front(array(
|
||||
array( 'css' => '#fipf_prof_paiement_echoue {display: block;}' )
|
||||
));
|
||||
}
|
||||
|
||||
update_user_meta($user_id, 'fipf_payement_status', '');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* series of check to do before printing a prof author page
|
||||
@@ -64,6 +112,9 @@ function check_prof_page_CIPF() {
|
||||
$author_id = get_queried_object_id();
|
||||
|
||||
handle_prof_is_activ_CIPF($author_id);
|
||||
|
||||
show_prof_paiement_messages_CIPF($author_id);
|
||||
|
||||
}
|
||||
add_action('template_redirect', 'check_prof_page_CIPF', 11);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user