Skip to:
Content

BuddyPress.org

Ticket #4309: 4309.01.patch

File 4309.01.patch, 1.2 KB (added by r-a-y, 14 years ago)
  • bp-core/admin/bp-core-functions.php

     
    1010// Exit if accessed directly
    1111if ( !defined( 'ABSPATH' ) ) exit;
    1212
     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 */
     22function 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}
     34add_action( 'bp_deactivation', 'bp_switch_theme_on_deactivate' );
     35
    1336/** Menu **********************************************************************/
    1437
    1538/**