diff --git a/plugins/wporg-5ftf/includes/pledge-form.php b/plugins/wporg-5ftf/includes/pledge-form.php index bd47193..b345d1c 100755 --- a/plugins/wporg-5ftf/includes/pledge-form.php +++ b/plugins/wporg-5ftf/includes/pledge-form.php @@ -24,24 +24,26 @@ function render_form_new() { $action = isset( $_GET['action'] ) ? filter_input( INPUT_GET, 'action' ) : filter_input( INPUT_POST, 'action' ); $data = get_form_submission(); $messages = []; + $pledge = null; $complete = false; $directory_url = get_permalink( get_page_by_path( 'pledges' ) ); $view = 'form-pledge-new.php'; if ( 'Submit Pledge' === $action ) { - $processed = process_form_new(); + $pledge_id = process_form_new(); - if ( is_wp_error( $processed ) ) { - $messages = array_merge( $messages, $processed->get_error_messages() ); - } elseif ( 'success' === $processed ) { + if ( is_wp_error( $pledge_id ) ) { + $messages = array_merge( $messages, $pledge_id->get_error_messages() ); + } elseif ( is_int( $pledge_id ) ) { $complete = true; } - } else if ( 'confirm_pledge_email' === $action ) { + } elseif ( 'confirm_pledge_email' === $action ) { $view = 'form-pledge-confirm-email.php'; $pledge_id = filter_input( INPUT_GET, 'pledge_id', FILTER_VALIDATE_INT ); + $pledge = get_post( $pledge_id ); $unverified_token = filter_input( INPUT_GET, 'auth_token', FILTER_SANITIZE_STRING ); $email_confirmed = process_pledge_confirmation_email( $pledge_id, $action, $unverified_token ); - } else if ( filter_input( INPUT_GET, 'resend_pledge_confirmation' ) ) { + } elseif ( filter_input( INPUT_GET, 'resend_pledge_confirmation' ) ) { $pledge_id = filter_input( INPUT_GET, 'pledge_id', FILTER_VALIDATE_INT ); $complete = true; @@ -58,11 +60,11 @@ function render_form_new() { /** * Process a submission from the New Pledge form. * - * @return string|WP_Error String "success" if the form processed correctly. Otherwise WP_Error. + * @return int|WP_Error The post ID of the new pledge if the form processed correctly. Otherwise WP_Error. */ function process_form_new() { $submission = get_form_submission(); - $has_error = check_invalid_submission( $submission ); + $has_error = check_invalid_submission( $submission ); if ( $has_error ) { return $has_error; } @@ -99,7 +101,7 @@ function process_form_new() { ) ); set_post_thumbnail( $new_pledge_id, $logo_attachment_id ); - return 'success'; + return $new_pledge_id; } /** diff --git a/plugins/wporg-5ftf/views/form-pledge-confirm-email.php b/plugins/wporg-5ftf/views/form-pledge-confirm-email.php index 2c19433..8335d74 100755 --- a/plugins/wporg-5ftf/views/form-pledge-confirm-email.php +++ b/plugins/wporg-5ftf/views/form-pledge-confirm-email.php @@ -1,21 +1,41 @@
- Thank you for confirming your address! We've emailed confirmation links to your contributors, and your pledge will show up in the directory once one of them confirms their participation. + the directory once one contributor confirms their participation.", 'wporg' ) ), + esc_url( $directory_url ) + ); + ?>
+ + ++ %1$s', + esc_url( get_permalink( $pledge ) ) + ) + ) ); ?> +
+ + +