Making WordPress.org

Changeset 1285


Ignore:
Timestamp:
02/19/2015 10:42:25 PM (12 years ago)
Author:
obenland
Message:

WP.org Themes: Improve check for pre-existing themes.

We need to specify post stati, so the check for an existing theme doesn't fail
for users who lack the ability to preview drafts.

See #745.

File:
1 edited

Legend:

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

    r1274 r1285  
    277277                        'post_type'        => 'repopackage',
    278278                        'orderby'          => 'ID',
    279                         'post_status'      => 'any',
     279
     280                        /*
     281                         * Specify post stati so this query returns a result for draft themes, even
     282                         * if the uploading user doesn't have have the permission to view drafts.
     283                         */
     284                        'post_status'      => array( 'publish', 'pending', 'draft', 'future' ),
    280285                        'suppress_filters' => false,
    281286                ) );
    282 
    283                 $theme = array_pop( $themes );
     287                $theme = current( $themes );
    284288
    285289                if ( ! empty( $theme ) ) {
Note: See TracChangeset for help on using the changeset viewer.