Skip to:
Content

Changeset 6436


Ignore:
Timestamp:
10/22/12 05:24:36 (18 months ago)
Author:
johnjamesjacoby
Message:

Theme Compat:

  • Put back 'bp_register_theme_directory' sub action, hooked to 'bp_loaded'
  • Move register_theme_directory() back into BuddyPress root class method.
  • Introduces old_themes_dir variable, which will get deprecated when we remove bp-default from core.
  • Create 'bp-templates' root folder, for theme-compat templates to live in, and not conflict with 'bp-themes'.
  • Fixes issue where 'bp-legacy' would show up as "Broken" in Appearance > Themes.
  • Brute-force switch from bp-default to WP_DEFAULT_THEME on deactivation, and update theme roots, to fix issue when deactivating BuddyPress while theme stack relies on bp-default.
  • See #3741
Location:
trunk
Files:
1 added
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-actions.php

    r6324 r6436  
    4949 * Attach various loader actions to the bp_loaded action. 
    5050 * The load order helps to execute code at the correct time. 
    51  *                                                     v---Load order 
     51 *                                                      v---Load order 
    5252 */ 
    53 add_action( 'bp_loaded', 'bp_setup_components',        2  ); 
    54 add_action( 'bp_loaded', 'bp_include',                 4  ); 
    55 add_action( 'bp_loaded', 'bp_setup_widgets',           6  ); 
    56 add_action( 'bp_loaded', 'bp_core_load_admin_bar',     10 ); 
    57 add_action( 'bp_loaded', 'bp_register_theme_packages', 16 ); 
     53add_action( 'bp_loaded', 'bp_setup_components',         2  ); 
     54add_action( 'bp_loaded', 'bp_include',                  4  ); 
     55add_action( 'bp_loaded', 'bp_setup_widgets',            6  ); 
     56add_action( 'bp_loaded', 'bp_core_load_admin_bar',      10 ); 
     57add_action( 'bp_loaded', 'bp_register_theme_packages',  12 ); 
     58add_action( 'bp_loaded', 'bp_register_theme_directory', 14 ); 
    5859 
    5960/** 
  • trunk/bp-core/bp-core-dependency.php

    r6342 r6436  
    127127 
    128128/** 
     129 * The main action used registering theme directory 
     130 * 
     131 * @since BuddyPress (1.5) 
     132 * @uses do_action() 
     133 */ 
     134function bp_register_theme_directory() { 
     135    do_action( 'bp_register_theme_directory' ); 
     136} 
     137 
     138/** 
    129139 * The main action used registering theme packages 
    130140 * 
  • trunk/bp-core/bp-core-update.php

    r6301 r6436  
    181181    delete_site_transient( 'theme_roots' ); 
    182182 
     183    // Switch to WordPress's default theme if current parent or child theme 
     184    // depend on bp-default. This is to prevent white screens of doom. 
     185    if ( in_array( 'bp-default', array( get_template(), get_stylesheet() ) ) ) { 
     186        switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); 
     187        update_option( 'template_root',   get_raw_theme_root( WP_DEFAULT_THEME, true ) ); 
     188        update_option( 'stylesheet_root', get_raw_theme_root( WP_DEFAULT_THEME, true ) ); 
     189    } 
     190 
    183191    // Use as of (1.6) 
    184192    do_action( 'bp_deactivation' ); 
  • trunk/bp-loader.php

    r6416 r6436  
    332332 
    333333        // BuddyPress root directory 
    334         $this->file       = __FILE__; 
    335         $this->basename   = plugin_basename( $this->file ); 
    336         $this->plugin_dir = BP_PLUGIN_DIR; 
    337         $this->plugin_url = BP_PLUGIN_URL; 
    338  
    339         // Themes 
    340         $this->themes_dir = $this->plugin_dir . 'bp-themes'; 
    341         $this->themes_url = $this->plugin_url . 'bp-themes'; 
     334        $this->file           = __FILE__; 
     335        $this->basename       = plugin_basename( $this->file ); 
     336        $this->plugin_dir     = BP_PLUGIN_DIR; 
     337        $this->plugin_url     = BP_PLUGIN_URL; 
    342338 
    343339        // Languages 
    344         $this->lang_dir   = $this->plugin_dir . 'bp-languages'; 
     340        $this->lang_dir       = $this->plugin_dir . 'bp-languages'; 
     341 
     342        // Templates (theme compatability) 
     343        $this->themes_dir     = $this->plugin_dir . 'bp-templates'; 
     344        $this->themes_url     = $this->plugin_url . 'bp-templates'; 
     345 
     346        // Themes (for bp-default) 
     347        $this->old_themes_dir = $this->plugin_dir . 'bp-themes'; 
     348        $this->old_themes_url = $this->plugin_url . 'bp-themes'; 
    345349 
    346350        /** Theme Compat ******************************************************/ 
     
    351355        /** Users *************************************************************/ 
    352356 
    353         $this->current_user       = new stdClass(); 
    354         $this->displayed_user     = new stdClass(); 
     357        $this->current_user   = new stdClass(); 
     358        $this->displayed_user = new stdClass(); 
    355359    } 
    356360 
     
    498502            add_action( 'bp_' . $class_action, array( $this, $class_action ), 5 ); 
    499503 
    500         // Setup the BuddyPress theme directory 
    501         // @todo Move bp-default to wordpress.org/extend/themes and remove this 
    502         register_theme_directory( $this->themes_dir ); 
     504        // All BuddyPress actions are setup (includes bbp-core-hooks.php) 
     505        do_action_ref_array( 'bp_after_setup_actions', array( &$this ) ); 
    503506    } 
    504507 
    505508    /** Public Methods ********************************************************/ 
     509 
     510    /** 
     511     * Setup the BuddyPress theme directory 
     512     * 
     513     * @since BuddyPress (1.5) 
     514     * @todo Move bp-default to wordpress.org/extend/themes and remove this 
     515     */ 
     516    public function register_theme_directory() { 
     517        register_theme_directory( $this->old_themes_dir ); 
     518    } 
    506519 
    507520    /** 
Note: See TracChangeset for help on using the changeset viewer.