Last active
May 19, 2022 09:21
Revisions
-
rafiahmedd renamed this gist
May 19, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
rafiahmedd revised this gist
May 19, 2022 . No changes.There are no files selected for viewing
-
rafiahmedd revised this gist
Feb 27, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,4 +26,6 @@ add_filter('wppayform/validate_data_on_submission_item_quantity',function( $erro } } },10,4); ?> -
rafiahmedd revised this gist
Feb 27, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ <?php add_filter('wppayform/validate_data_on_submission_item_quantity',function( $error, $elementId, $element, $form_data){ global $wpdb; $formId = 46; //Please Add Your Form ID here -
rafiahmedd created this gist
Aug 18, 2021 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ add_filter('wppayform/validate_data_on_submission_item_quantity',function( $error, $elementId, $element, $form_data){ global $wpdb; $formId = 46; //Please Add Your Form ID here $transactions = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wpf_order_transactions WHERE form_id = {$formId}" ); $orders = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wpf_order_items WHERE form_id = {$formId}" ); $orderQuantity = []; $limit = 10; //Please Add Your Total Limit Here for ($i = 0; $i < count($transactions); $i++) { $transId = $transactions[$i]->submission_id; $paymentStatus = $transactions[$i]->status; for ($j = 0; $j < count($orders); $j++) { if ($transId == $orders[$j]->submission_id && $paymentStatus == 'paid') { $orderQuantity[] = $orders[$j]->quantity; $remain = $limit - array_sum($orderQuantity); $temp = $remain; if ($temp < $form_data['item_quantity']) { if($temp<=0){ return $error = "No tickets left."; }else{ return $error = "A fewer tickets left."; } } } } } },10,4);