Making WordPress.org


Ignore:
Timestamp:
03/01/2019 09:03:33 AM (8 years ago)
Author:
dd32
Message:

WordPress.TV: After a successful upload, keep the event-specific fields prefilled.

Fixes #4231.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php

    r7675 r8380  
    2424                        }
    2525
    26                         $redir = home_url( 'submit-video' );
     26                        $redir = home_url( '/submit-video/' );
     27
     28                        // Fields to prefill
     29                        $keep_fields = array(
     30                                'wptv_video_wordcamp',
     31                                'wptv_uploaded_by',
     32                                'wptv_email',
     33                                'wptv_language',
     34                                'post_category', // 'wptv_categories',
     35                                'wptv_producer_username',
     36                                'wptv_event',
     37                        );
    2738
    2839                        if ( $this->success ) {
    … …  
    3041                        } elseif ( $this->errors ) {
    3142                                $redir = add_query_arg( array( 'error' => $this->errors ), $redir );
     43
     44                                // Video upload failed, include the video-specific fields in pre-fill.
     45                                $keep_fields[] = 'wptv_video_title';
     46                                $keep_fields[] = 'wptv_speakers';
     47                                $keep_fields[] = 'wptv_video_description';
     48                                $keep_fields[] = 'wptv_slides_url';
     49
    3250                        } else {
     51                                $keep_fields = array();
    3352                                $redir = add_query_arg( array( 'error' => 5 ), $redir );
     53                        }
     54
     55                        // Keep some fields.
     56                        if ( $keep_fields ) {
     57                                $redir = add_query_arg(
     58                                        urlencode_deep(
     59                                                array_intersect_key(
     60                                                        $_POST,
     61                                                        array_flip( $keep_fields )
     62                                                )
     63                                        ),
     64                                        $redir
     65                                );
    3466                        }
    3567
Note: See TracChangeset for help on using the changeset viewer.