Conflict with sendgrid plugin
-
Hi,
We are using sendgrid plugin for emailing purposes. It generates an error as soon as we activate this (Pardot) plugin:
“SendGrid: wp_mail has been declared by another process or plugin, so you won’t be able to use SendGrid until the conflict is solved.”
Due to this error, our emails stop working can you please check why this happening? It works perfectly if we deactivate the plugin.Thanks
-
Hey @strategicwebsites,
This was recently reported and I’m working on a solution.
If you’d like to test out a working hotfix, try commenting out line 55 in
pardot.php.When we can expect an updated version of it?
We are getting wp_salt() function’s fatal error on site after commenting on the line as per the given instructions.The hotfix has not been a good solution for me. After commenting out line 55 of pardot.php, my website works fine for a few days, but eventually the fact that wp_salt isn’t defined causes an error, and WordPress stops working. (“There has been a critical error on your website.”) It starts working again if I temporarily uncomment line 55, then disable and re-enable the Pardot plugin. This has happened three times.
The last time I tried commenting out line 55, I first made sure the password stored in my pardot_settings option had one of the prefixes that indicates it’s a new, correctly-encrypted password. It did, so I figured that the old_pardot_decrypt function wouldn’t get called again, and it wouldn’t matter that wp_salt wasn’t defined. But this morning, the error happened again. When I checked the pardot_settings option, I found that the password no longer began with one of the four-letter prefixes.
-
This reply was modified 6 years, 3 months ago by
looksink.
@strategicwebsites @looksink We’re testing out a change now. We moved the pluggable.php include over to its specific function.
You can see the related change that’s being tested here: https://github.com/pardot/pardot-for-wordpress/pull/38
Feel free to manually make those changes to your plugin and let me know if it works for you!
Thanks for working on this!
The proposed commit might seem to fix the problem, but I think it could lead to sporadic unexpected behavior.
The
old_pardot_decryptfunction is called indirectly by thePardot_Settingsconstructor, which means that the timing of therequire_onceline will be more or less the same. Instead of happening at line 55 ofpardot.php, it’ll happen at line 62, whenpardot-settings-class.phpis included, because that’s the file that defines and then instantiates thePardot_Settingsclass.The only difference is that
pluggable.phpwon’t always be included too soon. But if and when it is included too soon, it will still cause conflicts with other plugins.To avoid conflicts, you need to refrain from including
pluggable.phpand put off callingwp_saltuntil after WordPress itself has includedpluggable.php. That happens around line 374 ofwp-settings.php. Just above this line, there’s a loop that loads all the plugins; just after it, there’s theplugins_loadedaction hook. Maybe you could move the instantiation ofPardot_Settings(or at least the call toupgrade_old_password) into a function that you then attach to theplugins_loadedhook?This patch avoids including
pluggable.php. After applying it and re-enabling the Pardot plugin, my non-prefixed password in the database was successfully encrypted and prefixed withNACL::.I don’t know if it could cause other problems, but it seems to be working for me.
diff --git a/trunk/includes/pardot-settings-class.php b/trunk/includes/pardot-settings-class.php index e21232a..39cdecd 100755 --- a/trunk/includes/pardot-settings-class.php +++ b/trunk/includes/pardot-settings-class.php @@ -1237,4 +1237,7 @@ HTML; * Instantiate this class to ensure the action and shortcode hooks are hooked. * This instantiation can only be done once (see it's __construct() to understand why.) */ -new Pardot_Settings(); +function pardot_settings_instantiate() { + new Pardot_Settings(); +} +add_action( 'plugins_loaded', 'pardot_settings_instantiate' ); diff --git a/trunk/pardot.php b/trunk/pardot.php index 1a4fefe..269818d 100755 --- a/trunk/pardot.php +++ b/trunk/pardot.php @@ -48,12 +48,6 @@ if ( ! defined( 'PARDOT_JS_CACHE_TIMEOUT' ) ) { } -/* This require is needed for wp_salt() which is used in the old method of decrypting if openssl is available - * otherwise we'll get an undefined function error for wp_salt() during the password reencryption - */ -if ( !function_exists('wp_salt') && defined( 'ABSPATH' ) && defined( 'WPINC' ) ) { - require_once ( ABSPATH . WPINC . '/pluggable.php' ); -} require( PARDOT_PLUGIN_DIR . '/includes/pardot-api-class.php' ); require( PARDOT_PLUGIN_DIR . '/includes/pardot-api-functions.php' ); require( PARDOT_PLUGIN_DIR . '/includes/pardot-forms-shortcode-popup-class.php' );-
This reply was modified 6 years, 3 months ago by
looksink. Reason: WordPress style
@looksink Thanks! I was cooking up something similar. We’ll get this tested ASAP.
Version 1.4.13 of the plugin should fix this issue. Please let me know if you’re still having trouble.
Thanks a ton for the patch, @looksink!
I just want to say thanks for this… helped us with a SendGrid conflict with one of our plugins π
-
This reply was modified 6 years, 3 months ago by
The topic ‘Conflict with sendgrid plugin’ is closed to new replies.