Use JS + AJAX to resend the confirmation email

This commit is contained in:
Kelly Dwan 2019-11-12 16:17:29 -05:00
parent 7dbc725581
commit d5c740ae84
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
5 changed files with 88 additions and 11 deletions

View file

@ -0,0 +1,28 @@
/* global ajaxurl, FiveForTheFuture_ManageNonce, jQuery */
/* eslint no-alert: "off" */
jQuery( document ).ready( function( $ ) {
function sendAjaxRequest( data, callback ) {
$.ajax( {
type: 'POST',
url: ajaxurl,
data: {
action: 'manage_contributors',
pledge_id: data.pledgePost || 0,
contributor_id: data.contributorPost || 0,
manage_action: data.action || '',
_ajax_nonce: FiveForTheFuture_ManageNonce,
},
success: callback,
dataType: 'json',
} );
}
$( '.contributor-list [data-action="resend-contributor-confirmation"]' ).click( function( event ) {
event.preventDefault();
sendAjaxRequest( event.currentTarget.dataset, function( response ) {
if ( response.message ) {
alert( response.message );
}
} );
} );
} );