• Resolved strategicwebsites

    (@strategicwebsites)


    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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Cliff Seal

    (@cliffseal)

    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.

    Thread Starter strategicwebsites

    (@strategicwebsites)

    @cliffseal

    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 4 years, 8 months ago by looksink.
    Plugin Author Cliff Seal

    (@cliffseal)

    @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_decrypt function is called indirectly by the Pardot_Settings constructor, which means that the timing of the require_once line will be more or less the same. Instead of happening at line 55 of pardot.php, it’ll happen at line 62, when pardot-settings-class.php is included, because that’s the file that defines and then instantiates the Pardot_Settings class.

    The only difference is that pluggable.php won’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.php and put off calling wp_salt until after WordPress itself has included pluggable.php. That happens around line 374 of wp-settings.php. Just above this line, there’s a loop that loads all the plugins; just after it, there’s the plugins_loaded action hook. Maybe you could move the instantiation of Pardot_Settings (or at least the call to upgrade_old_password) into a function that you then attach to the plugins_loaded hook?

    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 with NACL::.

    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 4 years, 8 months ago by looksink. Reason: WordPress style
    Plugin Author Cliff Seal

    (@cliffseal)

    @looksink Thanks! I was cooking up something similar. We’ll get this tested ASAP.

    Plugin Author Cliff Seal

    (@cliffseal)

    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!

    WP Zone

    (@aspengrovestudios)

    I just want to say thanks for this… helped us with a SendGrid conflict with one of our plugins ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Conflict with sendgrid plugin’ is closed to new replies.