[buddypress-trac] [BuddyPress] #4148: De-activating BP without changing theme first results in fatal error
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Sun Apr 15 12:50:33 UTC 2012
#4148: De-activating BP without changing theme first results in fatal error
--------------------------+-----------------------------
Reporter: hnla | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Theme | Version: 1.5.4
Severity: normal | Keywords:
--------------------------+-----------------------------
Although we had added the switch_theme() function in bp-default
functions.php to attempt to address issue of WP white screening if a theme
not selected before bp de-activation, it in fact does still occur.
Scenario / path to replicate:
De-activate BP - visit front of site you should receive a fatal error (
Call to undefined function bp_site_name() )
Back into dashboard - themes say WP default selected. Rename BP folder to
disable get site backup, re-enable and activate BP - do NOT activate a BP
theme visit site BP-default will be running!!
So there is an apparent issue with themes not reverting and of BP hanging
onto the options entry for 'stylesheet'
Looking at the switcher and it occurred that having this:
{{{
if ( !function_exists( 'bp_is_active' ) )
return;
// If BuddyPress is not activated, switch back to the default WP theme
if ( !defined( 'BP_VERSION' ) )
switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
}}}
Had to be wrong, as we were checking if BP active ( no it wasn't ) and
effectively exiting.
Changing to this:
{{{
// If BuddyPress is not activated, switch back to the default WP theme
first
if ( ! defined( 'BP_VERSION' ) )
switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
// And then escape from further action
if ( ! function_exists( 'bp_is_active' ) )
return;
}}}
Cured the issue and I could safely deactivate BP without worrying about
theme selection as the theme switcher was now able to run first before we
checked if BP active and exited.
Checked in DB and options field was being updated correctly.
Patch reverses order of these two items but maybe it's better simply
written as:
{{{
if( ! function_exists( 'bp_is_active' )
switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
return;
}}}
Do we need to check is_active and version?
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4148>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list