CMB2 conflict with Easy WP SMTP plugin
-
Hi,
We have just installed Easy WP SMTP and CMB2.
However when we activated CMB2 plugin, we go to Easy WP SMTP settings and got this error:
Warning: file_get_contents(): Filename cannot be empty in /yourwebroot/wp-content/plugins/easy-wp-smtp/easy-wp-smtp.php on line 307
Error occurred during settings import
Please check this issue. We checked with latest version on Github and got similar error too.
Thanks so much!****
RegardsThe page I need help with: [log in to see the link]
-
Is it happening when CMB2 is not activated? Cause activating CMB2 shouldn’t do much at all yet, since it’s primarily a library that requires user’s code addition
What version of Easy WP SMTP are you on? Asking because the latest version of that plugin, at that line/file, is a
wp_die()
callhttps://plugins.trac.wordpress.org/browser/easy-wp-smtp/tags/1.3.9.1/easy-wp-smtp.php#L307
Line 309 has a
file_get_contents()
call but it should only be getting reached if a POST request is being made withswpsmtp_import_settings
being part of that request.Hi Easy WP SMTP is version 1.3.9.2 and CMB2 version 2.7.0. It happen when active CMB2, if CMB2 deactivate it will working fine. Hope you can check it. Thanks so much! Regards!
ok, they forgot to tag 1.3.9.2 in their SVN, but trunk is at that version so the numbers are lining up.
It still doesn’t explain why this line from Easy WP SMTP is returning true enough for line 307 to be reached:
$is_import_settings = filter_input( INPUT_POST, 'swpsmtp_import_settings', FILTER_SANITIZE_NUMBER_INT );
Realistically, this is an issue on Easy WP SMTP’s end because it’s their code being odd simply by a different plugin being active.
Thanks so much for your support. We’ll create a topic on Easy WP SMTP forum.
****
Regards,
HaruThemeSounds good, thanks for the followup.
Hi,
Sorry we have just found the issue when Multiple CMB2s and helper-functions.php fatal errors.
We use this code:if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && !defined( 'CMB2_LOADED') ) { require_once WP_PLUGIN_DIR . '/cmb2/init.php'; } else { require_once PLUGIN_HARU_VIDI_DIR . '/includes/libraries/cmb2/init.php'; } if ( defined( 'CMB2_LOADED') ) { include_once PLUGIN_HARU_VIDI_DIR . '/includes/libraries/cmb2-conditionals/cmb2-conditionals.php'; include_once PLUGIN_HARU_VIDI_DIR . '/includes/libraries/cmb2-attached-posts/cmb2-attached-posts-field.php'; include_once PLUGIN_HARU_VIDI_DIR . '/includes/libraries/cmb2-radio-image/cmb2-radio-image.php'; include_once PLUGIN_HARU_VIDI_DIR . '/includes/libraries/cmb2-switch-button/cmb2-switch-button.php'; include_once PLUGIN_HARU_VIDI_DIR . '/includes/libraries/cmb-field-select2/cmb-field-select2.php'; include_once PLUGIN_HARU_VIDI_DIR . '/includes/libraries/cmb2-text-list/cmb2-text-list.php'; }
but when active we use this error:
Warning: include_once(/Users/abc/webroot/wordpress/abc/vidimo/wp-content/plugins/cmb2/includes/CMB2_Radio_Image.php): failed to open stream: No such file or directory in /Users/abc/webroot/wordpress/abc/vidimo/wp-content/plugins/cmb2/includes/helper-functions.php on line 44 Warning: include_once(): Failed opening '/Users/abc/webroot/wordpress/abc/vidimo/wp-content/plugins/cmb2/includes/CMB2_Radio_Image.php' for inclusion (include_path='.:') in /Users/abc/webroot/wordpress/abc/vidimo/wp-content/plugins/cmb2/includes/helper-functions.php on line 44 Warning: include_once(/Users/abc/webroot/wordpress/abc/vidimo/wp-content/plugins/cmb2/includes/CMB2_Switch_Button.php): failed to open stream: No such file or directory in /Users/abc/webroot/wordpress/harutheme/vidimo/wp-content/plugins/cmb2/includes/helper-functions.php on line 44
This happen only when both CMB2 and our plugin install and active.
Can you have a solution in this case?
Thanks so much!****
Best regards,
HaruThemeHi,
That’s seem the issue happen when a plugin included CMB2 in their plugin and still install and active CMB2 plugin. It will cause conflict and got this error.****
Regards,
HaruThemeThis is because classes in CMB2 extensions should not begin with
CMB2_
. Then the CMB2 class autoloader kicks in and tries to load it from the CMB2 directory. Please prefix the extension classes with your own prefix and try again. If you got these extensions from someone else, please also notify if them of this issue.Thanks for your feedback!
We already changed all class and now it’s working fine.
However the issue come from CMB2 Conditionals.
https://github.com/jcchavezs/cmb2-conditionals
On line 99 of cmb2-conditionals.php need change the code from:
// Enable conditionals on front-end if using recent version of CMB2.
add_action( 'cmb2_footer_enqueue', array( $this, 'cmb2_footer' ), self::PRIORITY );
to
// Enable conditionals on front-end if using recent version of CMB2.if ( !is_admin() ) { add_action( 'cmb2_footer_enqueue', array( $this, 'cmb2_footer' ), self::PRIORITY ); }
Thanks so much for your help!
****
Best regards,
HaruThemeAlso, I see you are conditionally loading the cmb2 init file after a
file_exists
check. That may be ok for the other resources (but you should check theCMB2_LOADED
constant, not whether a file exists), but you should NOT do that for CMB2. Please review the caveats here: https://github.com/CMB2/CMB2/wiki/Basic-Usage#caveats-for-bundling-and-including-cmb2Thanks for your feedback and suggestion.
We checked and do it as tutorial.*****
Best regards,
HaruTheme
- The topic ‘CMB2 conflict with Easy WP SMTP plugin’ is closed to new replies.