| | 13 | /** Deactivation **************************************************************/ |
| | 14 | |
| | 15 | /** |
| | 16 | * When BuddyPress is deactivated, if the current theme is using bp-default, |
| | 17 | * the theme must be switched to another one since bp-default will no longer exist. |
| | 18 | * |
| | 19 | * @uses wp_get_theme() Get info about the current theme |
| | 20 | * @since 1.6-beta-2 |
| | 21 | */ |
| | 22 | function bp_switch_theme_on_deactivate() { |
| | 23 | $theme = wp_get_theme(); |
| | 24 | |
| | 25 | // if the current theme is using bp-default, let's switch the theme |
| | 26 | // when BP is deactivated to prevent WSOD on the front-end |
| | 27 | if ( $theme->stylesheet == 'bp-default' ) { |
| | 28 | switch_theme( |
| | 29 | apply_filters( 'bp_deactivate_switch_theme_template', WP_DEFAULT_THEME ), |
| | 30 | apply_filters( 'bp_deactivate_switch_theme_stylesheet', WP_DEFAULT_THEME ) |
| | 31 | ); |
| | 32 | } |
| | 33 | } |
| | 34 | add_action( 'bp_deactivation', 'bp_switch_theme_on_deactivate' ); |
| | 35 | |