Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: disable admin_notice #14

Closed
mitchelldmiller opened this issue Feb 12, 2018 · 9 comments
Closed

enhancement: disable admin_notice #14

mitchelldmiller opened this issue Feb 12, 2018 · 9 comments

Comments

@mitchelldmiller
Copy link

Hello Sal:
I just tested Stop Emails with my Quick Mail plugin, on a site using Mailgun plugin to send mail.

stop_emails

Message was sent, despite warning.

Please consider adding a setting to disable admin notice.

Best wishes,
Mitchell

@salcode
Copy link
Owner

salcode commented Feb 12, 2018

HI @mitchelldmiller

Thanks for the report about the plugin conflict.

If I understand you properly, this problem surfaced when using your plugin Quick Mail.

However, it sounds like the problem is how Stop Emails and the Mailgun plugin interact.

I'm hesitant to add a setting (or a filter) to disable the admin notice because I really want to avoid the situation where emails are being stopped and the website owner is oblivious to it.

Can you help me understand how disabling the Stop Emails admin notice would help in your situation?

Is your thought to disable the message on a specific site? or add code to your plugin to disable the notice? or something else I haven't thought of? 😀

I'd like to help address this problem but I also want to be cautious in what changes I make.

Thanks again for bringing this up and I would greatly appreciate your further feedback.

Thanks.

@mitchelldmiller
Copy link
Author

Hello @salcode,
Sorry for not being clear.

Somebody using Stop Emails with Quick Mail would see admin notice and think mail was disabled.

Similar result using Quick Mail without Mailgun. Only difference was a dumped array with message info in PHP error log.

screen shot 2018-02-12 at 3 37 43 pm

Quick Mail sends message using wp_mail(), despite warning.

Best wishes,
Mitchell

@salcode
Copy link
Owner

salcode commented Feb 13, 2018

Hi @mitchelldmiller,

I installed Quick Mail and Stop Emails on a test site running WordPress 4.9.4. I used WP CLI to download, install, and activate the plugins.

$ wp plugin install quick-mail stop-emails --activate

In Quick Mail Settings, I checked Grant Quick Mail permission to use your email address.

and clicked Save Options

screenshot 2018-02-12 21 42 06

I'm using Local by Flywheel which comes with MailHog, so I opened that browser tab.

Then using Tools > Quick Mail, I created a test mail with subject "test" and message "test".

screenshot 2018-02-12 21 45 10

then I clicked Send Mail.

I did not see any emails in MailHog (expected result)

screenshot 2018-02-12 21 46 51

Then I changed the Stop Email setting to log outgoing emails

screenshot 2018-02-12 21 47 54

Once again, I clicked Send Mail

Still no mail in MailHog but this time the email was logged to my error log. (expected result)

[13-Feb-2018 02:48:40 UTC] Array
(
    [to] => Array
        (
            [0] => Array
                (
                    [0] => test@ironcodestudio.com
                    [1] => 
                )

        )

    [cc] => Array
        (
        )

    [bcc] => Array
        (
        )

    [header] => Date: Tue, 13 Feb 2018 02:48:40 +0000
From: admin <dev-email@flywheel.local>
Reply-To: admin <dev-email@flywheel.local>
Message-ID: <adc0e92ea61ec5eefdd6cdd7397df698@genesis.test>
X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8

    [body] => Test

)

Finally, I deactivated the Stop Emails plugin

$ wp plugin deactivate stop-emails

and clicked Send Mail once again.

This time the email does appear in MailHog. (expected result)

screenshot 2018-02-12 21 51 32

I suspect there is another plugin conflict is causing the problem (e.g. the MailGun may be overriding email in a way that overrides Stop Emails). Of course, other factors can vary (or I may be missing something) so if you have a set of reproducible steps to recreate the error, I'd be happy to look into this further.

@salcode
Copy link
Owner

salcode commented Feb 13, 2018

@mitchelldmiller

If you want to make sure the Stop Emails plugin does not run, you can add some code to deactivate it, if the plugin is active.

This code checks for the Stop Emails plugin every time a backend page loads, if the plugin is active it deactivates it.

function deactivate_stop_emails_if_active() {
	$active_plugins = get_option('active_plugins');
	$result = array_search( 'stop-emails/stop-emails.php', $active_plugins, true );
	if ( false !== $result ) {
		deactivate_plugins( 'stop-emails/stop-emails.php' );
	}
}
add_action( 'admin_init', 'deactivate_stop_emails_if_active' );

@mitchelldmiller
Copy link
Author

Hello @salcode ,
Thank you for testing.
I tested with Quick Mail's WP-CLI command from version_342 branch which has better messages.
qm-cli

Same result. Mailgun is not affected.
If I deactivate Mailgun, and send a link:
wp quick-mail me@example.com you@example.com https://wheredidmybraingo.com/disclaimer/ "Blog Disclaimer"

The screen fills with error_log output. You might want to replace the error_log() if WP-CLI is active.

If you want to make sure the Stop Emails plugin does not run, you can add some code to deactivate it, if the plugin is active.

This would confuse your plugin's users. I will add Stop Emails info to FAQ.

Best wishes,
Mitchell

@salcode
Copy link
Owner

salcode commented Feb 16, 2018

Thanks for the information. I just opened #15 regarding behavior via WP CLI. 👍

@mitchelldmiller
Copy link
Author

Hello @salcode ,
Stop Emails does not prevent SparkPost plugin from sending mail.

I added info to latest Quick Mail readme.

Best wishes,
Mitchell

@salcode
Copy link
Owner

salcode commented Feb 22, 2018

Thanks @mitchelldmiller, I've added SparkPost to wiki/Known-Incompatible-Plugins

@salcode
Copy link
Owner

salcode commented Dec 14, 2018

This conversation went in a helpful direction and allowed me to add some new entries to the Known Incompatible Plugins in the Wiki.

Since the original focus of the issue, "disable admin_notice", is not a change I'm going to make, I'm going to close this issue.

@salcode salcode closed this as completed Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants