Fix warnings on new pledge form

This commit is contained in:
Kelly Dwan 2019-11-25 16:49:11 -05:00
parent a58b5e958c
commit a794829c4d
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
2 changed files with 6 additions and 1 deletions

View file

@ -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;

View file

@ -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 ] ) ) {