Email: Send pledge confirmation with authentication token.

Fixes #34.
Fixes #10.
This commit is contained in:
Ian Dunn 2019-10-23 11:16:02 -07:00
parent 6fe5a92c7b
commit 147da5ae24
No known key found for this signature in database
GPG key ID: 99B971B50343CBCB
7 changed files with 476 additions and 6 deletions

View file

@ -184,10 +184,19 @@ function render_meta_boxes( $pledge, $box ) {
* @param WP_Post $pledge
*/
function save_pledge( $pledge_id, $pledge ) {
$action = filter_input( INPUT_GET, 'action' );
$get_action = filter_input( INPUT_GET, 'action' );
$post_action = $_POST['action'] ?? null;
$ignored_actions = array( 'trash', 'untrash', 'restore' );
if ( $action && in_array( $action, $ignored_actions, true ) ) {
/*
* This is only intended to run when the front end form and wp-admin forms are submitted, not when posts are
* programmatically updated.
*/
if ( 'Submit Pledge' !== $post_action && 'editpost' !== $get_action ) {
return;
}
if ( $get_action && in_array( $get_action, $ignored_actions, true ) ) {
return;
}