From 0df2579963815b83075a2e84599403e09abdb030 Mon Sep 17 00:00:00 2001 From: imath Date: Sun, 30 Jul 2023 17:42:33 +0200 Subject: [PATCH] Do not replace BP Default on 12.0 upgrade if it comes from `/themes` --- inc/core/filters.php | 5 +++++ inc/migrate.php | 5 +++++ languages/bp-classic.pot | 2 +- package.json | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/inc/core/filters.php b/inc/core/filters.php index 25a070c..745966a 100644 --- a/inc/core/filters.php +++ b/inc/core/filters.php @@ -82,6 +82,11 @@ function bp_classic_default_theme_root_uri( $theme_root_uri, $siteurl, $styleshe * @since 1.0.0 */ function bp_classic_update_bp_default_theme_options() { + // If the current active template theme is not BP Default from the BuddyPress plugin, stop. + if ( false === strpos( get_template_directory(), 'plugins/buddypress/bp-themes/bp-default' ) ) { + return; + } + $theme_root = str_replace( content_url(), '', bp_classic_get_themes_url() ); if ( 'bp-default' === get_template() ) { diff --git a/inc/migrate.php b/inc/migrate.php index 843a961..656fa0e 100644 --- a/inc/migrate.php +++ b/inc/migrate.php @@ -102,6 +102,11 @@ function bp_classic_switch_directory_post_type( $post_type = '' ) { * @since 1.0.0 */ function bp_classic_restore_default_theme() { + // If the current active template theme is not BP Default from the this plugin, stop. + if ( false === strpos( get_template_directory(), 'bp-classic/themes/bp-default' ) ) { + return; + } + // Force refresh theme roots. delete_site_transient( 'theme_roots' ); diff --git a/languages/bp-classic.pot b/languages/bp-classic.pot index 408ef54..10f6f7e 100644 --- a/languages/bp-classic.pot +++ b/languages/bp-classic.pot @@ -9,7 +9,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-07-29T12:06:13+00:00\n" +"POT-Creation-Date: 2023-07-30T15:41:02+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.5.0\n" "X-Domain: bp-classic\n" diff --git a/package.json b/package.json index 997694a..dbc41f1 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0-beta1", "description": "BuddyPress Classic backward compatibility plugin.", "scripts": { - "bpdefault": "svn export --force https://github.com/buddypress/BP-Default.git/trunk themes/bp-default", + "bpdefault": "svn export --force https://github.com/buddypress/BP-Default.git/branches/prepare/bp-classic-moving themes/bp-default", "pot": "wp i18n make-pot . --exclude=\".phpcs,node_modules,tests,vendor\" languages/bp-classic.pot --headers='{\"Project-Id-Version\": \"BP Classic\", \"Report-Msgid-Bugs-To\": \"https://github.com/buddypress/bp-classic/issues\", \"Last-Translator\": \"JOHN JAMES JACOBY \", \"Language-Team\": \"ENGLISH \"}'" }, "repository": {