• Dear,

    We run the uncode theme and that includes a customized version of VC, I have read through the code and I see the validation of the existence of VC does not yet take in account custom installation directories.

    The current check looks like this

    if ( is_plugin_active( 'js_composer/js_composer.php' ) ){
        
    /* Constants */
    define( 'ASVC_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
    define( 'ASVC_DIR', rtrim( plugin_dir_path( __FILE__ ), '/' ) );
    if ( ! function_exists( 'prime_WordPressCheckup' ) ) {
        function prime_WordPressCheckup( $version = '3.8' ) {
            global $wp_version;
            if ( version_compare( $wp_version, $version, '>=' ) ) {
                return "true";
            } else {
                return "false";
            }
        }
    }

    and

    else {
        function asvc_required_plugin() {
            if ( is_admin() && current_user_can( 'activate_plugins' ) &&  !is_plugin_active( 'js_composer/js_composer.php' ) ) {
                add_action( 'admin_notices', 'asvc_required_plugin_notice' );
    
                deactivate_plugins( plugin_basename( __FILE__ ) ); 
    
                if ( isset( $_GET['activate'] ) ) {
                    unset( $_GET['activate'] );
                }
            }
    
        }
    add_action( 'admin_init', 'asvc_required_plugin' );
    
        function asvc_required_plugin_notice(){
            ?><div class="error">Error! you need to install or activate the <a target="_blank" href="https://codecanyon.net/item/visual-composer-page-builder-for-wordpress/242431?ref=themebonwp">WPBakery Page Builder for WordPress (formerly Visual Composer)</a> plugin to run "<span style="font-weight: bold;">Flipbox Addon for WPBakery Page Builder</span>" plugin.
    </div><?php
        }
    }

    Would it be possible to rewrite the check in such a way that it verifies in a different way if VC is installed. For example the method that massive add-ons is using?

    add_action( 'init', 'mpc_check_vc' );
    if ( ! function_exists( 'mpc_check_vc' ) ) {
    	function mpc_check_vc() {
    		// Exit when full package of MA is active
    		if ( plugin_basename( __FILE__ ) != 'mpc-massive/mpc-massive.php' && ( defined( 'MPC_MASSIVE_FULL' ) || is_plugin_active( 'mpc-massive/mpc-massive.php' ) ) ) {
    			return;
    		}
    
    		if ( defined( 'WPB_VC_VERSION' ) ) {
    			if ( version_compare( WPB_VC_VERSION, '4.7', '<' ) ) {
    				add_action( 'admin_notices', 'mpc_vc_outdated' );
    
    				return;
    			}
    
    			define( 'MPC_MASSIVE_FALLBACK', ! function_exists( 'vc_lean_map' ) );
    
    			$mpc_ma_version = get_option( 'mpc_ma_version' );
    			if ( ! $mpc_ma_version || version_compare( MPC_MASSIVE_VERSION, $mpc_ma_version, '>' ) ) {
    				update_option( 'mpc_ma_version', MPC_MASSIVE_VERSION );
    
    				if ( ! $mpc_ma_version ) {
    					set_transient( 'mpc_setup_wizard', true );
    				}
    
    				MPC_Utils::add_htaccess_rules();
    			}
    
    			/* Add panel settings */
    			require_once( mpc_get_plugin_path( __FILE__, 'dir' ) . '/panel/panel.php' );
    
    			if ( is_admin() ) {
    
    				/* Add welcome screen */
    				if ( get_transient( 'mpc_setup_wizard' ) ) {
    					set_transient( 'mpc_setup_wizard', false );
    
    					wp_redirect( admin_url( 'admin.php?page=ma-setup' ) );
    				}
    				if ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'ma-setup' ) {
    					require_once( mpc_get_plugin_path( __FILE__, 'dir' ) . '/panel/extra/welcome-screen.php' );
    				}
    
    				/* Add system info */
    				require_once( mpc_get_plugin_path( __FILE__, 'dir' ) . '/panel/extra/system-info.php' );
    
    				/* Add page installer */
    				if ( defined( 'MPC_MASSIVE_FULL' ) ) {
    					require_once( mpc_get_plugin_path( __FILE__, 'dir' ) . '/panel/extra/page-installer.php' );
    				}
    
    				/* Add automatic updates */
    				if ( defined( 'MPC_MASSIVE_FULL' ) ) {
    					require_once( mpc_get_plugin_path( __FILE__, 'dir' ) . '/panel/extra/updater.php' );
    					if ( class_exists( 'MPC_Plugin_Updater' ) ) {
    						$MPC_Massive_Updater = new MPC_Plugin_Updater( __FILE__ );
    					}
    				}
    
    				/* Add params */
    				require_once( mpc_get_plugin_path( __FILE__, 'dir' ) . '/params/params.php' );
    			}
    
    			/* Add shortcodes */
    			require_once( mpc_get_plugin_path( __FILE__, 'dir' ) . '/shortcodes/shortcodes.php' );
    			do_action( 'mpc_load_shortcodes' );
    		} else {
    			add_action( 'admin_notices', 'mpc_vc_disabled' );
    		}
    	}
    }
    
    if ( ! function_exists( 'mpc_vc_disabled' ) ) {
    	function mpc_vc_disabled() {
    		echo '<div class="notice notice-error">' . __( '<strong>Massive Addons</strong>: Please install and activate WPBakery Page Builder to use this plugin', 'mpc' ) . '
    </div>';
    	}
    }
    
    if ( ! function_exists( 'mpc_vc_outdated' ) ) {
    	function mpc_vc_outdated() {
    		echo '<div class="notice notice-warning">' . __( '<strong>Massive Addons</strong>: Please update WPBakery Page Builder to the newest version to use this plugin', 'mpc' ) . '
    </div>';
    	}
    }

    The reason for this request is that some themes that come pre-bundled with VC install in a custom dir like /uncode-js_composer/js_composer.php

  • The topic ‘Uncompatile with custom VC installations (UNCODE THEME AND MORE)’ is closed to new replies.