Skip to content

Commit d70c803

Browse files
committed
Fixed plan and plan interval settings.
1 parent a570759 commit d70c803

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

public/class-paystack-forms-public.php

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,6 @@ function kkd_pff_paystack_form_shortcode($atts) {
601601
}else{
602602
$showbtn = false;
603603
}
604-
605-
606-
607604
}
608605

609606
}
@@ -890,6 +887,7 @@ function kkd_pff_paystack_submit_action() {
890887
unset($metadata['pf-pemail']);
891888
unset($metadata['pf-amount']);
892889
unset($metadata['pf-user_id']);
890+
unset($metadata['pf-interval']);
893891

894892
// echo '<pre>';
895893

@@ -991,7 +989,12 @@ function kkd_pff_paystack_submit_action() {
991989
$paystack_response = json_decode(wp_remote_retrieve_body($request));
992990
// print_r($paystack_response);
993991
$plancode = $paystack_response->data->plan_code;
994-
// echo $plancod;
992+
$fixedmetadata[] = [
993+
'display_name' => 'Plan Interval',
994+
'variable_name' => 'Plan Interval',
995+
'type' => 'text',
996+
'value' => $paystack_response->data->interval
997+
];
995998

996999
}
9971000
# code...
@@ -1004,6 +1007,15 @@ function kkd_pff_paystack_submit_action() {
10041007
unset($metadata['pf-plancode']);
10051008
}
10061009
}
1010+
if($plancode != 'none'){
1011+
$fixedmetadata[] = [
1012+
'display_name' => 'Plan',
1013+
'variable_name' => 'Plan',
1014+
'type' => 'text',
1015+
'value' => $plancode
1016+
];
1017+
}
1018+
10071019
$insert = array(
10081020
'post_id' => strip_tags($_POST["pf-id"], ""),
10091021
'email' => strip_tags($_POST["pf-pemail"], ""),
@@ -1056,6 +1068,20 @@ function kkd_pff_paystack_meta_as_custom_fields($metadata){
10561068
'display_name' => 'Full Name',
10571069
'variable_name' => 'Full_Name',
10581070
'type' => 'text',
1071+
'value' => $value
1072+
];
1073+
}elseif ($key == 'pf-plancode') {
1074+
$custom_fields[] = [
1075+
'display_name' => 'Plan',
1076+
'variable_name' => 'Plan',
1077+
'type' => 'text',
1078+
'value' => $value
1079+
];
1080+
}elseif ($key == 'pf-interval') {
1081+
$custom_fields[] = [
1082+
'display_name' => 'Plan Interval',
1083+
'variable_name' => 'Plan Interval',
1084+
'type' => 'text',
10591085
'value' => $value
10601086
];
10611087
}else{

0 commit comments

Comments
 (0)