mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-19 01:43:44 +03:00
Pledges: Rename input field to match handler expectation.
Previously the field wasn't being saved when a new pledge was created.
This commit is contained in:
parent
fff279aa34
commit
2927532544
|
@ -81,7 +81,7 @@ function process_form_new() {
|
|||
);
|
||||
}
|
||||
|
||||
$contributors = parse_contributors( $submission['pledge-contributors'] );
|
||||
$contributors = parse_contributors( $submission['org-pledge-contributors'] );
|
||||
|
||||
if ( is_wp_error( $contributors ) ) {
|
||||
return $contributors;
|
||||
|
@ -184,7 +184,7 @@ function get_form_submission() {
|
|||
wp_list_pluck( PledgeMeta\get_pledge_meta_config( 'user_input' ), 'php_filter' ),
|
||||
// Inputs with no corresponding meta value.
|
||||
array(
|
||||
'pledge-contributors' => FILTER_SANITIZE_STRING,
|
||||
'org-pledge-contributors' => FILTER_SANITIZE_STRING,
|
||||
'pledge-agreement' => FILTER_VALIDATE_BOOLEAN,
|
||||
)
|
||||
);
|
||||
|
@ -246,7 +246,7 @@ function get_pledge_contributors( $pledge_id = 0 ) {
|
|||
$contributors = array();
|
||||
|
||||
// Get POST'd submission, if it exists.
|
||||
$submission = filter_input( INPUT_POST, 'pledge-contributors', FILTER_SANITIZE_STRING );
|
||||
$submission = filter_input( INPUT_POST, 'org-pledge-contributors', FILTER_SANITIZE_STRING );
|
||||
|
||||
// Get existing pledge, if it exists.
|
||||
$pledge = get_post( $pledge_id );
|
||||
|
|
|
@ -60,6 +60,12 @@ function get_pledge_meta_config( $context = '' ) {
|
|||
'show_in_rest' => false,
|
||||
'php_filter' => FILTER_VALIDATE_INT,
|
||||
),
|
||||
'org-pledge-contributors' => array(
|
||||
'single' => true,
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'show_in_rest' => false,
|
||||
'php_filter' => FILTER_SANITIZE_STRING,
|
||||
),
|
||||
);
|
||||
|
||||
$generated = array(
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
|||
<input
|
||||
type="text"
|
||||
id="5ftf-pledge-contributors"
|
||||
name="pledge-contributors"
|
||||
value="<?php echo esc_attr( $data['pledge-contributors'] ); ?>"
|
||||
name="org-pledge-contributors"
|
||||
value="<?php echo esc_attr( $data['org-pledge-contributors'] ); ?>"
|
||||
required
|
||||
aria-describedby="5ftf-pledge-contributors-help"
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue