Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter rylu

    (@rylu)

    Hi Dmytro!

    Your code is flawless. I ran it with live payments and everything went smoothly.

    I really appreciate your assistance and expertise. You and your team are amazing!

    All the best!

    Thread Starter rylu

    (@rylu)

    Hi Adam,

    thank you for quick response.

    The modification of the code which ensures that there is only one shared number across all forms works.

    However, the problem with skipping numbers remains. I used the updated code from the gist, changed configuration part, saved and reloaded website. The last number was “4”. I filled the form with payment field. It required 3D secure, I apporoved it, then the card was declined (due to insufficint money). So the form did not send. Next, I filled the form again, now in test mode, to make a succesfull submission. After I filled the form and submitted succesfully, the number was “7”. The next succesfull submission was “8”. Then I tried to submit in live mode with no money again – it failed (again, 3D secure was required). Next submision in test mode was succesfull and number was “11”. It’s the exact behaviour as in previous code, no change.

    Thanks for looking into this.

    Thread Starter rylu

    (@rylu)

    Hello guys again,

    I tought it finally works, but it does not. After I made some payments in live mode, where 3D secure was required and failed payment (tried to pay with no money on the card), I found out that it keeps skipping numbers. It looks like it updates DB option with +1 every time the form is submitted, regardless of its success. I have this problem with the longer code from github (adjusted by Kris, but also without the adjustments).

    The shorter code that Luis gave me handles this problem well – it doesn’t skip numbers (meta_value is increased +1 only after a successfull submission), but on the other hand, it doesn’t inject right values into the email subject and body (I need this) and doesn’t have the ability to reset the number, have prefix and suffix etc.

    So, in short, I need the longer code (the functionality), but need to fix the problem with skipping numbers, as the shorter code does. I spent all day on this but it’s apparently beyond my programming abilities.

    I’d be very thankful if you helped me once more.

    Thread Starter rylu

    (@rylu)

    Hello Kris,

    you’re absolutely the best. The solution works perfectly and you totally surprised me how fast you are. You guys are the reason I think you’re the best WP plugin!

    Also, as there is no need for form_id check in reset_number function anymore, I adjusted the code a little to be able to set the $start_number right in the url which resets the order number:

    // reset number function
    			public function reset_number() {
    				if ( current_user_can( 'manage_options' ) && isset( $_GET['wpmudev-fm-reset-number'] ) ) {
    				    
    					$this->start_number = (int) $_GET['wpmudev-fm-reset-number'];
    					
    					$order_numbers             = get_option( 'wpmudev_fm_autoincremented_field', array() );
    					$order_numbers[0] = $this->start_number;
    
    					update_option( 'wpmudev_fm_autoincremented_field', $order_numbers );
    
    					
    				}
    			}

    For other readers of this post: to reset the numbering and set the new starting number with this code (after replacing the original one), access url yoursite.com/wp-admin?wpmudev-fm-reset-number=1 instead of the original one (yoursite.com/wp-admin?wpmudev-fm-reset-number-by-form-id=[form_id]), replacing “1” with number you want to start the new number sequence from.

    This eliminates the need to change the $start_number in the php file every time you want to reset the numbering AND start from other number than 1 (otherwise you would need first to change the $start_number and after that access reset number url).

    Now the code is perfect for me.

    Thank you, forminator team!

    Thread Starter rylu

    (@rylu)

    Hi Adam,

    your solution works well. Thank you for the explanation.

    However, in another discussion, I’ve found a code snippet that I like even better: https://gist.github.com/adczk/fbf06b6abf7753df6b37234b13041e79. It allows me to reset number, set prefix and suffix etc. It comes very handy.

    The only thing I miss in this longer code is the function you helped me with already in the shorter code – shared number across all forms (currently the code stores numbers for each form separately).

    Would it be possible to modify the code from github so that there is only one shared number across all forms (submission of form A is #1, submission of form B increments number to #2, another submission of form A increments number to #3 etc.)?

    Thanks in advance.

    Thread Starter rylu

    (@rylu)

    Thank you for quick response!

    However, maybe I have not described the problem clearly enough.

    I actually want all forms to have one common submission number sequence. F.e. if submission ID of form A is currently #3, next submission ID of form B will be #4, next submission of form A will be #5 etc. I need this functionality, since I have two forms on the website and both of them need to generate invoices which share one numbering sequence.

    The form B has not been even submitted yet (it is on private page protected with password, only I can submit this form). The problem is as I described earlier: The submission ID is skipping numbers when submitting the form with stripe payment field (it apparently skips more numbers if the payment fails before a succesfull submission). Even in the database, I can see only two rows in frmt_form_entry table: submission #2 and submission #7. I need it to be #1, #2, #3 etc., whatever form is submitted.

    I hope the problem is clearer now.

    Thanks for looking into this!

Viewing 6 replies - 1 through 6 (of 6 total)