Just a quick sample to demonstrate how you could approach asking "Are you sure" when saving a payment
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() { | |
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