diff --git a/src/bp-core/compatibility/bp-incompatible-plugins-helper.php b/src/bp-core/compatibility/bp-incompatible-plugins-helper.php index d296114834..8c0cea86f3 100644 --- a/src/bp-core/compatibility/bp-incompatible-plugins-helper.php +++ b/src/bp-core/compatibility/bp-incompatible-plugins-helper.php @@ -17,7 +17,7 @@ function bp_helper_plugins_loaded_callback() { * * Support for LearnDash & bbPress Integration */ - if ( in_array( 'learndash-bbpress/learndash-bbpress.php', $bp_plugins ) ) { + if ( class_exists( 'Learndash_BBPress' ) ) { /** * Remove bbPress Integration admin init hook action @@ -26,7 +26,7 @@ function bp_helper_plugins_loaded_callback() { */ remove_action( 'admin_init', 'wdm_activation_dependency_check' ); - if ( empty( bp_is_active( 'forums' ) ) || empty( in_array( 'sfwd-lms/sfwd_lms.php', $bp_plugins ) ) ) { + if ( empty( bp_is_active( 'forums' ) ) || ! class_exists( 'SFWD_LMS' ) ) { deactivate_plugins( 'learndash-bbpress/learndash-bbpress.php' ); add_action( 'admin_notices', 'bp_core_learndash_bbpress_notices' ); @@ -39,7 +39,7 @@ function bp_helper_plugins_loaded_callback() { * * Support Rank Math SEO */ - if ( in_array( 'seo-by-rank-math/rank-math.php', $bp_plugins ) && ! is_admin() ) { + if ( class_exists( 'RankMath' ) && interface_exists( 'RankMath\Paper\IPaper' ) && ! is_admin() ) { require buddypress()->compatibility_dir . '/bp-rankmath-plugin-helpers.php'; } @@ -48,7 +48,7 @@ function bp_helper_plugins_loaded_callback() { * * Support Elementor */ - if ( in_array( 'elementor/elementor.php', $bp_plugins ) ) { + if ( class_exists( '\Elementor\Plugin' ) ) { require buddypress()->compatibility_dir . '/bp-elementor-plugin-helpers.php'; } @@ -57,7 +57,7 @@ function bp_helper_plugins_loaded_callback() { * * Support Co-Authors Plus */ - if ( in_array( 'co-authors-plus/co-authors-plus.php', $bp_plugins ) ) { + if ( class_exists( 'CoAuthors_Plus' ) ) { add_filter( 'bp_search_settings_post_type_taxonomies', 'bp_core_remove_authors_taxonomy_for_co_authors_plus', 100, 2 ); } @@ -66,7 +66,7 @@ function bp_helper_plugins_loaded_callback() { * * Support MemberPress + BuddyPress Integration */ - if ( in_array( 'memberpress-buddypress/main.php', $bp_plugins ) ) { + if ( class_exists( 'MpBuddyPress' ) ) { /** * This action is use when admin bar is Enable */ @@ -83,7 +83,7 @@ function bp_helper_plugins_loaded_callback() { * * Support WPML Multilingual CMS */ - if ( in_array( 'sitepress-multilingual-cms/sitepress.php', $bp_plugins ) ) { + if ( class_exists( 'SitePress' ) && class_exists( 'WPML_Fix_Links_In_Display_As_Translated_Content' ) ) { require buddypress()->compatibility_dir . '/class-bb-wpml-helpers.php'; } @@ -92,14 +92,14 @@ function bp_helper_plugins_loaded_callback() { * * @since BuddyBoss 1.5.4 */ - if ( in_array( 'wishlist-member/wpm.php', $bp_plugins ) ) { + if ( class_exists( 'WishListMember' ) ) { global $WishListMemberInstance; remove_filter( 'user_request_action_email_content', array( &$WishListMemberInstance, 'privacy_user_request_email' ), 10 ); remove_filter( 'user_request_action_email_subject', array( &$WishListMemberInstance, 'privacy_user_request_email_subject' ), 10 ); remove_filter( 'wp_privacy_personal_data_email_content', array( &$WishListMemberInstance, 'privacy_personal_data_email' ), 10 ); } - if ( in_array( 'instructor-role/instructor.php', $bp_plugins, true ) ) { + if ( class_exists( '\InstructorRole\Includes\Instructor_Role' ) ) { /** * Function to exclude group type post to prevent group role overriding. @@ -121,7 +121,7 @@ function bp_core_instructor_role_post_exclude( $exclude_posts ) { add_filter( 'wdmir_exclude_post_types', 'bp_core_instructor_role_post_exclude', 10, 1 ); } - if ( in_array( 'geodirectory/geodirectory.php', $bp_plugins, true ) ) { + if ( class_exists( 'GeoDirectory' ) ) { /** * Function to deregister some scripts and styles from bp component pages @@ -183,7 +183,7 @@ function bp_deregister_geodirectory_styles() { * * Support The Events Calendar. */ - if ( in_array( 'the-events-calendar/the-events-calendar.php', $bp_plugins, true ) ) { + if ( class_exists( 'Tribe__Events__Main' ) ) { require buddypress()->compatibility_dir . '/class-bb-the-events-calendar-helpers.php'; } @@ -226,7 +226,7 @@ function( $builder_load_requests ) { * * Support Memberpress */ - if ( in_array( 'memberpress/memberpress.php', $bp_plugins ) ) { + if ( class_exists( 'MeprAppCtrl' ) ) { add_filter( 'mepr_design_style_handle_prefixes', function ( $allowed_handle_prefixes ) { $allowed_handle_prefixes[] = 'admin-bar'; $allowed_handle_prefixes[] = 'bp-'; @@ -242,7 +242,7 @@ function( $builder_load_requests ) { * * @since BuddyBoss 2.5.60 */ - if ( in_array( 'instructor-role/instructor.php', $bp_plugins ) ) { + if ( class_exists( '\InstructorRole\Includes\Instructor_Role' ) ) { add_filter( 'ir_filter_remove_private_protected_from_titles', function ( $is_prepend, $prepend, $post ) { $post_types = array(); @@ -556,7 +556,7 @@ function bb_core_add_support_mepr_signup_map_user_fields( $txn ) { function bp_core_learndash_bbpress_notices() { global $bp_plugins; - if ( empty( bp_is_active( 'forums' ) ) || empty( in_array( 'sfwd-lms/sfwd_lms.php', $bp_plugins ) ) ) { + if ( empty( bp_is_active( 'forums' ) ) || ! class_exists( 'SFWD_LMS' ) ) { $links = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ); $text = sprintf( '%s', $links, __( 'Forum Discussions', 'buddyboss' ) );