Making WordPress.org

Ticket #1207: fix-allow-submitting-subtitle-for-same-language.diff

File fix-allow-submitting-subtitle-for-same-language.diff, 2.0 KB (added by robfelty, 3 years ago)

fix to allow resubmission of caption for a language which has already been submitted

  • wptv2/plugins/wordpresstv-upload-subtitles/wordpresstv-upload-subtitles.php

    diff --git a/wptv2/plugins/wordpresstv-upload-subtitles/wordpresstv-upload-subtitles.php b/wptv2/plugins/wordpresstv-upload-subtitles/wordpresstv-upload-subtitles.php
    index 9ee766e66..6848190d9 100644
    a b class WordPressTV_Subtitles_Upload { 
    139139                $language = $available_languages[ $language ];
    140140
    141141                $video_data       = function_exists( 'video_get_info_by_blogpostid' ) ? video_get_info_by_blogpostid( get_current_blog_id(), $video_id ) : new StdClass;
     142                l();
     143                l($video_data->guid);
    142144                $video_attachment = get_post( $video_id );
    143145                if ( empty( $video_data ) || empty( $video_attachment ) ) {
    144146                        wp_die( 'Invalid form data.' );
    class WordPressTV_Subtitles_Upload { 
    150152                        wp_die( 'You can not subtitle this video.' );
    151153                }
    152154
    153                 $tracks = class_exists( 'VideoPress_Subtitles' ) ? VideoPress_Subtitles::get_tracks( $video_data->guid ) : array();
    154                 if ( ! empty( $tracks[ $language['key'] ] ) ) {
    155                         $this->error( 8 );
    156                 }
    157 
    158155                if ( empty( $_FILES['wptv_subtitles_file']['name'] ) ) {
    159156                        $this->error( 1 );
    160157                }
  • wptv2/upload-subtitles-template.php

    diff --git a/wptv2/upload-subtitles-template.php b/wptv2/upload-subtitles-template.php
    index e5c939bb2..ec221a5ce 100644
    a b if ( ! empty( $_REQUEST['error'] ) ) { 
    276276                                                <select name="wptv_language">
    277277                                                        <?php $tracks = VideoPress_Subtitles::get_tracks( $video->guid ); ?>
    278278                                                        <?php foreach ( VideoPress_Subtitles::get_languages() as $value => $language ) : ?>
    279                                                                 <option value="<?php echo esc_attr( $value ); ?>" <?php disabled( ! empty( $tracks[ $value ] ) ); ?> ><?php echo esc_html( $language['localized_label'] ); ?></option>
     279                                                                <option value="<?php echo esc_attr( $value ); ?>" ><?php echo esc_html( $language['localized_label'] ); ?></option>
    280280                                                        <?php endforeach; ?>
    281281                                                </select>
    282282                                        </td>