Skip to content

Instantly share code, notes, and snippets.

@mintplugins
Created April 23, 2019 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mintplugins/b36f6a97a7eff38880e4ac17f3710b70 to your computer and use it in GitHub Desktop.
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
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