Making WordPress.org

Changeset 12249


Ignore:
Timestamp:
11/17/2022 01:55:33 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: When checking to see if a conflicting plugin exists with the same Readme title, use a more specific error for when the conflicting plugin is owned by someone else.

This avoids the situation where someone is told to update it in SVN, when they haven't even submitted it yet (just had a copy-paste error in readme.txt).
This also avoids erroring out for plugins which do not have a parsable title in the readme, which isn't strictly required.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

    r12179 r12249  
    279279            'post_status' => array( 'publish', 'pending', 'disabled', 'closed', 'new', 'draft', 'approved' ),
    280280        ) );
    281         if ( $readme_plugin_post ) {
     281        if ( $readme_plugin_post && trim( $readme->name ) ) {
    282282            $error = __( 'README Error: The plugin has already been submitted.', 'wporg-plugins' );
     283
     284            if ( $readme_plugin_post->post_author != get_current_user_id() ) {
     285                return new \WP_Error( 'already_submitted', $error . ' ' . sprintf(
     286                    /* translators: 1: plugin slug, 2: 'Plugin Name:' */
     287                    __( 'There is already a plugin with the name %1$s in the directory. You must rename your plugin by changing the %2$s line in your main plugin file and in your readme. Once you have done so, you may upload it again.', 'wporg-plugins' ),
     288                    '<code>' . esc_html( $readme->name ) . '</code>',
     289                    '<code>Plugin Name:</code>'
     290                ) );
     291            }
    283292
    284293            return new \WP_Error( 'already_submitted', $error . ' ' . sprintf(
Note: See TracChangeset for help on using the changeset viewer.