Skip to content

Instantly share code, notes, and snippets.

@New0
Created February 28, 2018 09:47
Show Gist options
  • Save New0/2e2226af9138c326427fab6bdfa3c0af to your computer and use it in GitHub Desktop.
Save New0/2e2226af9138c326427fab6bdfa3c0af to your computer and use it in GitHub Desktop.
Caldera Forms Paypal express process, send an email when a user cancels a Paypal express payment
<?php
add_action( 'caldera_forms_redirect_preprocess', function( $url, $form, $process_id ){
//Change the Form ID
if( $form['ID'] === 'CF5a5e8452c6f82' ) {
//Set the recipient the sbuject and the message
$recipient = '[email protected]';
$subject = 'My Email Subject';
$message = 'My Email content';
global $transdata;
$form['mailer']['recipients'] = $recipient;
$form['mailer']['email_subject'] = $subject;
$form['mailer']['email_message'] = $message;
if( $transdata['type'] === 'error' && $transdata['note'] === 'Transaction has been canceled' ) {
Caldera_Forms_Save_Final::do_mailer( $form, null, $transdata['data'] );
}
}
}, 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment