Making WordPress.org


Ignore:
Timestamp:
03/13/2015 12:04:27 PM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Don't update theme post until new version was approved.

Theme description and tags might change in new versions, so the post can't be
updated with that new information until that version has been approved.

This also fixes a bug where the post date would be set to the upload date of
the new version, mixing new themes with updated themes in the Latest Themes
view in the Directory.

Fixes #943.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php

    r1385 r1397  
    525525    public function create_or_update_theme_post( $ticket_id ) {
    526526        $upload_date = current_time( 'mysql' );
    527         $post_args   = array(
    528             'post_author'    => $this->author->ID,
    529             'post_title'     => $this->theme->get( 'Name' ),
    530             'post_name'      => $this->theme_slug,
    531             'post_content'   => $this->theme->get( 'Description' ),
    532             'post_parent'    => $this->theme->post_parent,
    533             'post_date'      => $upload_date,
    534             'comment_status' => 'closed',
    535             'ping_status'    => 'closed',
    536             'post_type'      => 'repopackage',
    537             'tags_input'     => $this->theme->get( 'Tags' ),
    538         );
    539 
    540         // If we already have a post, update it.
     527
     528        // If we already have a post, get its ID.
    541529        if ( ! empty( $this->theme_post ) ) {
    542             $post_args['ID'] = $this->theme_post->ID;
    543 
    544             $post_id = wp_update_post( $post_args );
    545 
    546             // Otherwise create it for this new theme.
     530            $post_id = $this->theme_post->ID;
     531
     532        // Otherwise create it for this new theme.
    547533        } else {
    548             $post_id = wp_insert_post( $post_args );
     534            $post_id = wp_insert_post( array(
     535                'post_author'    => $this->author->ID,
     536                'post_title'     => $this->theme->get( 'Name' ),
     537                'post_name'      => $this->theme_slug,
     538                'post_content'   => $this->theme->get( 'Description' ),
     539                'post_parent'    => $this->theme->post_parent,
     540                'post_date'      => $upload_date,
     541                'post_date_gmt'  => $upload_date,
     542                'comment_status' => 'closed',
     543                'ping_status'    => 'closed',
     544                'post_type'      => 'repopackage',
     545                'tags_input'     => $this->theme->get( 'Tags' ),
     546            ) );
    549547        }
    550548
Note: See TracChangeset for help on using the changeset viewer.