WordPress.org

Making WordPress.org

Changeset 9255


Ignore:
Timestamp:
11/03/2019 05:22:28 PM (3 months ago)
Author:
dd32
Message:

Plugin Directory: Add a warning/block to the plugin upload screen to prevent users with "unsafe" email addresses from submitting plugins.

"unsafe" emails on WordPress.org include domains we consider spam and those who reject all emails from us. As these users can't receive emails, we can't allow them to upload a plugin until they change to an email host which does accept our emails.

Fixes #4781.

File:
1 edited

Legend:

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

    r8891 r9255  
    166166            <?php endif; // wp_verify_nonce() && 'upload' === $_POST['action'] ?>
    167167
    168             <?php if ( ! $submitted_counts->total && ( ! $upload_result || is_wp_error( $upload_result ) ) ) : ?>
     168            <?php
     169            if ( is_email_address_unsafe( wp_get_current_user()->user_email ) ) {
     170                echo '<div class="notice notice-error notice-alt"><p>' .
     171                    sprintf(
     172                        /* translators: %s: Profile edit url. */
     173                        __( 'Your email host has email deliverability problems. Please <a href="%s">Update your email address</a> first.', 'wporg-plugins'),
     174                        esc_url( 'https://wordpress.org/support/users/' . wp_get_current_user()->user_nicename . '/edit' )
     175                     ) .
     176                     "</p></div>\n";
     177
     178            } else if ( ! $submitted_counts->total && ( ! $upload_result || is_wp_error( $upload_result ) ) ) : ?>
    169179
    170180                <form id="upload_form" class="plugin-upload-form" enctype="multipart/form-data" method="POST" action="">
Note: See TracChangeset for help on using the changeset viewer.