Making WordPress.org


Ignore:
Timestamp:
07/10/2015 08:32:01 PM (11 years ago)
Author:
iandunn
Message:

WordPress.tv: Give credit to video producers.

Fixes #986
Props BrashRebel

File:
1 edited

Legend:

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

    r1650 r1724  
    4848        $text_fields = array(
    4949            'wptv_video_title',
    50             'wptv_video_producer',
     50            'wptv_producer_username',
    5151            'wptv_speakers',
    5252            'wptv_event',
     
    6161
    6262            return $this->error( 13 );
     63        }
     64
     65        if ( ! empty( $_POST['wptv_producer_username'] ) && ! wporg_username_exists( $_POST['wptv_producer_username'] ) ) {
     66            return $this->error( 14 );
    6367        }
    6468
     
    260264
    261265        $video_title    = $this->sanitize_text( $_posted['wptv_video_title'] );
    262         $video_producer = $this->sanitize_text( $_posted['wptv_video_producer'] );
     266        $producer_username = $this->sanitize_text( $_posted['wptv_producer_username'] );
    263267        $speakers       = $this->sanitize_text( $_posted['wptv_speakers'] );
    264268        $event          = $this->sanitize_text( $_posted['wptv_event'] );
     
    267271        $slides         = $this->sanitize_text( $_posted['wptv_slides_url'] );
    268272        $ip             = $_SERVER['REMOTE_ADDR'];
     273        // todo realign in separate commit
    269274
    270275        $categories = '';
     
    283288            'submitted_email' => $anon_author_email,
    284289            'title'           => $video_title,
    285             'producer'        => $video_producer,
     290            'producer_username' => $producer_username,
    286291            'speakers'        => $speakers,
    287292            'event'           => $event,
     
    291296            'slides'          => $slides,
    292297            'ip'              => $ip,
     298            // todo realign in separate commit
    293299        );
    294300
     
    325331        $embed_args['post_id'] = $meta['attachment_id'];
    326332
    327         // Add slides index to meta (necessary for posts that were uploaded before the field was added)
    328         if ( ! array_key_exists( 'slides', $meta ) ) {
    329             $meta['slides'] = '';
     333        // Add missing indexes to $meta (necessary for posts that were uploaded before the fields were added)
     334        $new_fields = array( 'slides', 'producer_username' );
     335        foreach ( $new_fields as $field ) {
     336            if ( ! array_key_exists( $field, $meta ) ) {
     337                $meta[ $field ] = '';
     338            }
    330339        }
    331340
     
    461470
    462471                    <div class="row">
    463                         <p class="label">Producer:</p>
    464                         <p class="data">
    465                             <input type="text" value="<?php echo esc_attr( $meta['producer'] ); ?>"/>
    466                             <a class="button-secondary anon-approve" href="#new-tag-producer">Approve</a>
     472                        <p class="label">Producer WordPress.org Username:</p>
     473
     474                        <p class="data">
     475                            <input type="text" value="<?php echo esc_attr( $meta['producer_username'] ); ?>"/>
     476                            <a class="button-secondary anon-approve" href="#new-tag-producer-username">Approve</a>
    467477                        </p>
    468478                    </div>
Note: See TracChangeset for help on using the changeset viewer.