{"id":14286602,"date":"2021-04-07T07:49:09","date_gmt":"2021-04-07T07:49:09","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/compatability-with-uncode\/"},"modified":"2021-04-07T07:52:40","modified_gmt":"2021-04-07T07:52:40","slug":"compatability-with-uncode","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/compatability-with-uncode\/","title":{"rendered":"Compatability with uncode"},"content":{"rendered":"<p>Dear, <\/p>\n<p>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. <\/p>\n<p>The current check looks like this <\/p>\n<pre><code>if ( is_plugin_active( &#039;js_composer\/js_composer.php&#039; ) ){\n    \n\/* Constants *\/\ndefine( &#039;ASVC_URL&#039;, rtrim( plugin_dir_url( __FILE__ ), &#039;\/&#039; ) );\ndefine( &#039;ASVC_DIR&#039;, rtrim( plugin_dir_path( __FILE__ ), &#039;\/&#039; ) );\nif ( ! function_exists( &#039;prime_WordPressCheckup&#039; ) ) {\n    function prime_WordPressCheckup( $version = &#039;3.8&#039; ) {\n        global $wp_version;\n        if ( version_compare( $wp_version, $version, &#039;&gt;=&#039; ) ) {\n            return &quot;true&quot;;\n        } else {\n            return &quot;false&quot;;\n        }\n    }\n}<\/code><\/pre>\n<p>and <\/p>\n<pre><code>else {\n    function asvc_required_plugin() {\n        if ( is_admin() &amp;&amp; current_user_can( &#039;activate_plugins&#039; ) &amp;&amp;  !is_plugin_active( &#039;js_composer\/js_composer.php&#039; ) ) {\n            add_action( &#039;admin_notices&#039;, &#039;asvc_required_plugin_notice&#039; );\n\n            deactivate_plugins( plugin_basename( __FILE__ ) ); \n\n            if ( isset( $_GET[&#039;activate&#039;] ) ) {\n                unset( $_GET[&#039;activate&#039;] );\n            }\n        }\n\n    }\nadd_action( &#039;admin_init&#039;, &#039;asvc_required_plugin&#039; );\n\n    function asvc_required_plugin_notice(){\n        ?&gt;&lt;div class=&quot;error&quot;&gt;&lt;p&gt;Error! you need to install or activate the &lt;a target=&quot;_blank&quot; href=&quot;https:\/\/codecanyon.net\/item\/visual-composer-page-builder-for-wordpress\/242431?ref=themebonwp&quot;&gt;WPBakery Page Builder for WordPress (formerly Visual Composer)&lt;\/a&gt; plugin to run &quot;&lt;span style=&quot;font-weight: bold;&quot;&gt;Flipbox Addon for WPBakery Page Builder&lt;\/span&gt;&quot; plugin.&lt;\/p&gt;&lt;\/div&gt;&lt;?php\n    }\n}<\/code><\/pre>\n<p>Woudl 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 addons is ussing? <\/p>\n<pre><code>add_action( &#039;init&#039;, &#039;mpc_check_vc&#039; );\nif ( ! function_exists( &#039;mpc_check_vc&#039; ) ) {\n\tfunction mpc_check_vc() {\n\t\t\/\/ Exit when full package of MA is active\n\t\tif ( plugin_basename( __FILE__ ) != &#039;mpc-massive\/mpc-massive.php&#039; &amp;&amp; ( defined( &#039;MPC_MASSIVE_FULL&#039; ) || is_plugin_active( &#039;mpc-massive\/mpc-massive.php&#039; ) ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( defined( &#039;WPB_VC_VERSION&#039; ) ) {\n\t\t\tif ( version_compare( WPB_VC_VERSION, &#039;4.7&#039;, &#039;&lt;&#039; ) ) {\n\t\t\t\tadd_action( &#039;admin_notices&#039;, &#039;mpc_vc_outdated&#039; );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdefine( &#039;MPC_MASSIVE_FALLBACK&#039;, ! function_exists( &#039;vc_lean_map&#039; ) );\n\n\t\t\t$mpc_ma_version = get_option( &#039;mpc_ma_version&#039; );\n\t\t\tif ( ! $mpc_ma_version || version_compare( MPC_MASSIVE_VERSION, $mpc_ma_version, &#039;&gt;&#039; ) ) {\n\t\t\t\tupdate_option( &#039;mpc_ma_version&#039;, MPC_MASSIVE_VERSION );\n\n\t\t\t\tif ( ! $mpc_ma_version ) {\n\t\t\t\t\tset_transient( &#039;mpc_setup_wizard&#039;, true );\n\t\t\t\t}\n\n\t\t\t\tMPC_Utils::add_htaccess_rules();\n\t\t\t}\n\n\t\t\t\/* Add panel settings *\/\n\t\t\trequire_once( mpc_get_plugin_path( __FILE__, &#039;dir&#039; ) . &#039;\/panel\/panel.php&#039; );\n\n\t\t\tif ( is_admin() ) {\n\n\t\t\t\t\/* Add welcome screen *\/\n\t\t\t\tif ( get_transient( &#039;mpc_setup_wizard&#039; ) ) {\n\t\t\t\t\tset_transient( &#039;mpc_setup_wizard&#039;, false );\n\n\t\t\t\t\twp_redirect( admin_url( &#039;admin.php?page=ma-setup&#039; ) );\n\t\t\t\t}\n\t\t\t\tif ( ! empty( $_GET[ &#039;page&#039; ] ) &amp;&amp; $_GET[ &#039;page&#039; ] == &#039;ma-setup&#039; ) {\n\t\t\t\t\trequire_once( mpc_get_plugin_path( __FILE__, &#039;dir&#039; ) . &#039;\/panel\/extra\/welcome-screen.php&#039; );\n\t\t\t\t}\n\n\t\t\t\t\/* Add system info *\/\n\t\t\t\trequire_once( mpc_get_plugin_path( __FILE__, &#039;dir&#039; ) . &#039;\/panel\/extra\/system-info.php&#039; );\n\n\t\t\t\t\/* Add page installer *\/\n\t\t\t\tif ( defined( &#039;MPC_MASSIVE_FULL&#039; ) ) {\n\t\t\t\t\trequire_once( mpc_get_plugin_path( __FILE__, &#039;dir&#039; ) . &#039;\/panel\/extra\/page-installer.php&#039; );\n\t\t\t\t}\n\n\t\t\t\t\/* Add automatic updates *\/\n\t\t\t\tif ( defined( &#039;MPC_MASSIVE_FULL&#039; ) ) {\n\t\t\t\t\trequire_once( mpc_get_plugin_path( __FILE__, &#039;dir&#039; ) . &#039;\/panel\/extra\/updater.php&#039; );\n\t\t\t\t\tif ( class_exists( &#039;MPC_Plugin_Updater&#039; ) ) {\n\t\t\t\t\t\t$MPC_Massive_Updater = new MPC_Plugin_Updater( __FILE__ );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t\/* Add params *\/\n\t\t\t\trequire_once( mpc_get_plugin_path( __FILE__, &#039;dir&#039; ) . &#039;\/params\/params.php&#039; );\n\t\t\t}\n\n\t\t\t\/* Add shortcodes *\/\n\t\t\trequire_once( mpc_get_plugin_path( __FILE__, &#039;dir&#039; ) . &#039;\/shortcodes\/shortcodes.php&#039; );\n\t\t\tdo_action( &#039;mpc_load_shortcodes&#039; );\n\t\t} else {\n\t\t\tadd_action( &#039;admin_notices&#039;, &#039;mpc_vc_disabled&#039; );\n\t\t}\n\t}\n}\n\nif ( ! function_exists( &#039;mpc_vc_disabled&#039; ) ) {\n\tfunction mpc_vc_disabled() {\n\t\techo &#039;&lt;div class=&quot;notice notice-error&quot;&gt;&lt;p&gt;&#039; . __( &#039;&lt;strong&gt;Massive Addons&lt;\/strong&gt;: Please install and activate WPBakery Page Builder to use this plugin&#039;, &#039;mpc&#039; ) . &#039;&lt;\/p&gt;&lt;\/div&gt;&#039;;\n\t}\n}\n\nif ( ! function_exists( &#039;mpc_vc_outdated&#039; ) ) {\n\tfunction mpc_vc_outdated() {\n\t\techo &#039;&lt;div class=&quot;notice notice-warning&quot;&gt;&lt;p&gt;&#039; . __( &#039;&lt;strong&gt;Massive Addons&lt;\/strong&gt;: Please update WPBakery Page Builder to the newest version to use this plugin&#039;, &#039;mpc&#039; ) . &#039;&lt;\/p&gt;&lt;\/div&gt;&#039;;\n\t}\n}<\/code><\/pre>\n<p>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<\/p>\n","protected":false},"template":"","class_list":["post-14286602","topic","type-topic","status-publish","hentry","topic-tag-uncode"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14286602","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14286602\/revisions"}],"predecessor-version":[{"id":14286616,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14286602\/revisions\/14286616"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=14286602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}