• Resolved davethedon

    (@davethedon)


    Hey,

    I had to add a line at the top of simple-cloudflare-turnstile.php in order to be able to run the is_plugin_active_for_network() function on the frontend. Otherwise all the integrations, like WooCommerce, weren’t loading the widget onto their forms on the multisite.

    // Needed for the is_plugin_active_for_network() function
    include_once(‘wp-admin/includes/plugin.php’);

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter davethedon

    (@davethedon)

    Or, perhaps better yet…

    /**
     * Custom "is_plugin_active" function.
     *
     * @param string $plugin
     * @return bool
     */
    if ( !function_exists( 'cft_is_plugin_active' ) ) {
    	function cft_is_plugin_active( $plugin ) {
    		return ( in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) || ( function_exists( 'cft_is_plugin_active_for_network' ) && cft_is_plugin_active_for_network( $plugin ) ) );
    	}
    }
    
    /**
     * Custom "is_plugin_active_for_network" function.
     *
     * @param string $plugin
     * @return bool
     */
    if ( is_multisite() && !function_exists( 'cft_is_plugin_active_for_network' ) ) {
    	function cft_is_plugin_active_for_network( $plugin ) {
    		$plugins = get_site_option( 'active_sitewide_plugins' );
    		if ( isset( $plugins[ $plugin ] ) ) {
    			return true;
    		}
    
    		return false;
    	}
    }
    • This reply was modified 2 years, 1 month ago by davethedon.

    Thanks, this should be fixed in the next update.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multisite Plugin Detection Issue’ is closed to new replies.