• Jose

    (@giuse)


    Hello

    in the main file of your plugin https://plugins.trac.www.ads-software.com/browser/sip-reviews-shortcode-woocommerce/tags/1.2.2/sip-reviews-shortcode-woocommerce.php at line 73 your plugin disables itself if WooCommece is not active.

    You call that code using the action “plugins_loaded” (line 28 of the same file), and it fires every time the page loads both on the backend and on the frontend.

    This usually doesn’t give any problem, but if you disable WooCommerce only on specific pages, and not globally from the page of plugins, on the pages where WooCommerce is disabled but your plugin is active, your plugin gets globally disabled.

    Maybe it is better you disable your plugin if WooCommerce is not active only after activation. Once is activated, I would check the presence of the classes and functions of WooCommerce before using them, and if they don’t exist you return nothing, but I would not programmatically disable your plugin.

    Of course, this is up to you and you decide what’s the best for your plugin. I wanted only to say that programmatically disabling your plugin may create some issues if the user has a plugin to selectively disable other plugins.

    I opened this thread because a user of my plugin (Freesoul Deactivate Plugins) reported a conflict between our two plugins. Because my plugin allows the user to disable WooCommerce only on specific pages, your plugin disabled itself.
    In this case, the issue reported by the user can be solved by being careful to disable your plugin everywhere WooCommerce is disabled, in this case, it’s not a big problem. The user doesn’t need your plugin where WooCommerce is not active.

    For future cases, if you want you could also replace

    if( !class_exists( ‘WooCommerce’ ) ) {

    }

    with:

    if( !class_exists( ‘WooCommerce’ ) && !defined( ‘EOS_WOOCOMMERCE_ACTIVE’ ) ){

    }

    That would solve the conflict with my plugin, no matter anymore if WooCommerce is disabled on specific pages, but be aware that there are also other plugins that allow the user to selectively disable third plugins, and you would have the same conflict with this kind of plugin.

  • The topic ‘Pugin disables itself in some. situations’ is closed to new replies.