Email: Send pledge confirmation with authentication token. (#46)

Email: Send pledge confirmation with authentication token.

Fixes #34.
Fixes #10.
This commit is contained in:
Ian Dunn 2019-10-25 12:07:09 -07:00 committed by GitHub
parent 284e616c84
commit 5ffca9420f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 496 additions and 7 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 = filter_input( INPUT_POST, 'action' );
$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;
}