Forked from mintplugins/Warn when saving any EDD payment
Last active
April 25, 2019 18:23
-
-
Save pippinsplugins/aa687db0c0c81e6305f35279246d6ece to your computer and use it in GitHub Desktop.
Just a quick sample to demonstrate how you could approach asking "Are you sure" when saving a payment
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 characters
function custom_prefix_warn_about_old_refunds_js() { | |
if ( ! isset( $_GET['prevent_accidental_refunds_js'] ) ) { | |
return false; | |
} | |
header('Content-Type: application/javascript'); | |
?> | |
jQuery( document ).on( 'click', '.edd-order-update-box', function() { | |
if( $('#edd_refund_in_stripe:checked').length > 0 || $('#edd_refund_in_paypal:checked').length ) { | |
return( | |
confirm('Are you sure you want to do this?') | |
); | |
} | |
} ); | |
<?php | |
die(); | |
} | |
add_action( 'init', 'custom_prefix_warn_about_old_refunds_js' ); | |
function custom_prefix_enqueue_warn_about_old_refunds_js() { | |
wp_enqueue_script( 'custom_prefix_prevent_accidental_refunds_js', get_bloginfo( 'wpurl' ) . '/?prevent_accidental_refunds_js', array( 'jquery' ) ); | |
} | |
add_action( 'admin_enqueue_scripts', 'custom_prefix_enqueue_warn_about_old_refunds_js' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment