awesomemotive / WP-Mail-SMTP

The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 4 million sites.
https://wordpress.org/plugins/wp-mail-smtp/
GNU General Public License v3.0
55 stars 35 forks source link

WPMS_SMTP_AUTH Constant defined to false - Username and password still editable #138

Open neovision-host opened 2 months ago

neovision-host commented 2 months ago

When WPMS_SMTP_AUTH is set to false, the username and password fields should be disabled.

image

Like this : image

This patch fix the problem

--- a/src/Providers/OptionsAbstract.php 2024-08-27 15:18:46.063537256 +0200
+++ b/src/Providers/OptionsAbstract.php 2024-08-27 15:30:39.056609839 +0200
@@ -331,7 +331,7 @@
        </div>

        <!-- SMTP Username -->
-       <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-user" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear <?php echo ! $this->connection_options->is_const_defined( $this->get_slug(), 'auth' ) && ! $this->connection_options->get( $this->get_slug(), 'auth' ) ? 'inactive' : ''; ?>">
+       <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-user" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear <?php echo $this->connection_options->is_const_defined( $this->get_slug(), 'auth' ) && ! $this->connection_options->get( $this->get_slug(), 'auth' ) ? 'inactive' : ''; ?>">
            <div class="wp-mail-smtp-setting-label">
                <label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-user"><?php esc_html_e( 'SMTP Username', 'wp-mail-smtp' ); ?></label>
            </div>
@@ -345,7 +345,7 @@
        </div>

        <!-- SMTP Password -->
-       <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-pass" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-password wp-mail-smtp-clear <?php echo ! $this->connection_options->is_const_defined( $this->get_slug(), 'auth' ) && ! $this->connection_options->get( $this->get_slug(), 'auth' ) ? 'inactive' : ''; ?>">
+       <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-pass" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-password wp-mail-smtp-clear <?php echo $this->connection_options->is_const_defined( $this->get_slug(), 'auth' ) && ! $this->connection_options->get( $this->get_slug(), 'auth' ) ? 'inactive' : ''; ?>">
            <div class="wp-mail-smtp-setting-label">
                <label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-pass"><?php esc_html_e( 'SMTP Password', 'wp-mail-smtp' ); ?></label>
            </div>

I'm still available

Thanks,

capuderg commented 2 months ago

Hi @neovision-host,

thank you for opening this GH issue and providing a fix.

Our team will fix this in the next plugin update.

Thank you and have a nice day!