From a794829c4d28a8f107bf8c000a3a08f1db628fa9 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Mon, 25 Nov 2019 16:49:11 -0500 Subject: [PATCH] Fix warnings on new pledge form --- plugins/wporg-5ftf/includes/pledge-form.php | 4 +++- plugins/wporg-5ftf/includes/pledge-meta.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/wporg-5ftf/includes/pledge-form.php b/plugins/wporg-5ftf/includes/pledge-form.php index 92b922c..380b4a4 100755 --- a/plugins/wporg-5ftf/includes/pledge-form.php +++ b/plugins/wporg-5ftf/includes/pledge-form.php @@ -22,6 +22,7 @@ add_shortcode( '5ftf_pledge_form_manage', __NAMESPACE__ . '\render_form_manage' */ function render_form_new() { $action = isset( $_GET['action'] ) ? filter_input( INPUT_GET, 'action' ) : filter_input( INPUT_POST, 'action' ); + $pledge_id = 0; $data = get_form_submission(); $errors = []; $pledge = null; @@ -256,7 +257,8 @@ function get_form_submission() { $result = filter_input_array( INPUT_POST, $input_filters ); if ( ! $result ) { - return []; + $result = array_fill_keys( array_keys( $input_filters ), '' ); + $result['empty_post'] = true; } return $result; diff --git a/plugins/wporg-5ftf/includes/pledge-meta.php b/plugins/wporg-5ftf/includes/pledge-meta.php index 5999855..e60f1a4 100755 --- a/plugins/wporg-5ftf/includes/pledge-meta.php +++ b/plugins/wporg-5ftf/includes/pledge-meta.php @@ -459,6 +459,9 @@ function get_pledge_meta( $pledge_id = 0, $subset = '' ) { // Get POST'd submission, if it exists. $submission = PledgeForm\get_form_submission(); + if ( $submission['empty_post'] ) { + $submission = array(); + } foreach ( $keys as $key => $config ) { if ( isset( $submission[ $key ] ) ) {