mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-01 16:51:18 +03:00
Fix warnings on new pledge form
This commit is contained in:
parent
a58b5e958c
commit
a794829c4d
|
@ -22,6 +22,7 @@ add_shortcode( '5ftf_pledge_form_manage', __NAMESPACE__ . '\render_form_manage'
|
||||||
*/
|
*/
|
||||||
function render_form_new() {
|
function render_form_new() {
|
||||||
$action = isset( $_GET['action'] ) ? filter_input( INPUT_GET, 'action' ) : filter_input( INPUT_POST, 'action' );
|
$action = isset( $_GET['action'] ) ? filter_input( INPUT_GET, 'action' ) : filter_input( INPUT_POST, 'action' );
|
||||||
|
$pledge_id = 0;
|
||||||
$data = get_form_submission();
|
$data = get_form_submission();
|
||||||
$errors = [];
|
$errors = [];
|
||||||
$pledge = null;
|
$pledge = null;
|
||||||
|
@ -256,7 +257,8 @@ function get_form_submission() {
|
||||||
|
|
||||||
$result = filter_input_array( INPUT_POST, $input_filters );
|
$result = filter_input_array( INPUT_POST, $input_filters );
|
||||||
if ( ! $result ) {
|
if ( ! $result ) {
|
||||||
return [];
|
$result = array_fill_keys( array_keys( $input_filters ), '' );
|
||||||
|
$result['empty_post'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -459,6 +459,9 @@ function get_pledge_meta( $pledge_id = 0, $subset = '' ) {
|
||||||
|
|
||||||
// Get POST'd submission, if it exists.
|
// Get POST'd submission, if it exists.
|
||||||
$submission = PledgeForm\get_form_submission();
|
$submission = PledgeForm\get_form_submission();
|
||||||
|
if ( $submission['empty_post'] ) {
|
||||||
|
$submission = array();
|
||||||
|
}
|
||||||
|
|
||||||
foreach ( $keys as $key => $config ) {
|
foreach ( $keys as $key => $config ) {
|
||||||
if ( isset( $submission[ $key ] ) ) {
|
if ( isset( $submission[ $key ] ) ) {
|
||||||
|
|
Loading…
Reference in a new issue