Created
April 23, 2019 22:20
-
-
Save mintplugins/b36f6a97a7eff38880e4ac17f3710b70 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() { | |
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