Skip to:
Content

Changeset 6404


Ignore:
Timestamp:
10/13/12 18:20:07 (18 months ago)
Author:
r-a-y
Message:

Theme Compat:

  • Introduce bp_is_theme_bp_default() function - this checks to see if the current theme uses bp-default. Replace all instances of bp_enable_theme_compat() with bp_is_theme_bp_default()
  • In bp-core-filters.php, switch out hardcoded locate_template() registration template checks for bp_has_custom_signup_page().
Location:
trunk
Files:
5 edited

Legend:

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

    r6402 r6404  
    459459 
    460460    $defaults = array( 
    461         'mode'     => bp_enable_theme_compat() ? 2 : 1, // 1 = $root, 2 = wp-login.php 
     461        'mode'     => bp_is_theme_bp_default() ? 1 : 2, // 1 = $root, 2 = wp-login.php 
    462462        'redirect' => $redirect_url,                    // the URL you get redirected to when a user successfully logs in 
    463463        'root'     => bp_get_root_domain(),         // the landing page you get redirected to when a user doesn't have access 
  • trunk/bp-core/bp-core-filters.php

    r6354 r6404  
    229229 
    230230    // Don't touch the email if we don't have a custom registration template 
    231     if ( '' == locate_template( array( 'registration/register.php' ), false ) && '' == locate_template( array( 'register.php' ), false ) ) 
     231    if ( ! bp_has_custom_signup_page() ) 
    232232        return $welcome_email; 
    233233 
     
    254254 
    255255    // Don't touch the email if we don't have a custom registration template 
    256     if ( '' == locate_template( array( 'registration/register.php' ), false ) && '' == locate_template( array( 'register.php' ), false ) ) 
     256    if ( ! bp_has_custom_signup_page() ) 
    257257        return $welcome_email; 
    258258 
  • trunk/bp-core/bp-core-theme-compatibility.php

    r6399 r6404  
    177177 
    178178/** 
    179  * See whether BuddyPress' theme compatibility is enabled or not. 
    180  * 
    181  * This differs from {@link bp_is_theme_compat_active()} as this function 
    182  * checks to see if theme compat is enabled across the active blog. 
    183  * 
    184  * @since BuddyPress (1.7) 
    185  * @uses wp_get_theme() 
    186  * @uses apply_filters() 
     179 * See whether the current theme is good ol' bp-default. 
     180 * 
     181 * @since BuddyPress (1.7) 
     182 * @uses get_stylesheet() 
    187183 * @return bool 
    188184 */ 
    189 function bp_enable_theme_compat() { 
    190  
    191     // default is theme compat should be enabled 
    192     $retval = true; 
    193  
    194     // get current theme 
    195     $theme = wp_get_theme(); 
    196  
    197     // get current theme's tags 
    198     $theme_tags = ! empty( $theme->tags ) ? $theme->tags : array(); 
    199  
    200     // check to see if the 'buddypress' tag is in the theme  
    201     // or if stylesheet is 'bp-default' 
    202     $backpat = in_array( 'buddypress', $theme_tags ) || $theme->get_stylesheet() == 'bp-default'; 
    203      
    204     // if we're already using a BP-compatible theme, disable theme compat 
    205     if ( $backpat ) { 
     185function bp_is_theme_bp_default() { 
     186    if ( get_stylesheet() == 'bp-default' ) { 
     187        $retval = true; 
     188    } else { 
    206189        $retval = false; 
    207  
    208     // if theme compat should still be enabled, do some other checks 
    209     // @todo what about themes that copied bp-default without using a child theme? 
    210     } elseif ( $retval ) { 
    211         // BP Template Pack check 
    212         // if TPack exists, we should disable theme compat 
    213         if ( function_exists( 'bp_tpack_theme_setup' ) ) { 
    214             $retval = false; 
    215         } 
    216     } 
    217  
    218     return apply_filters( 'bp_enable_theme_compat', $retval ); 
     190    } 
     191 
     192    return $retval; 
    219193} 
    220194 
  • trunk/bp-members/bp-members-template.php

    r6399 r6404  
    968968 
    969969function bp_has_custom_signup_page() { 
    970     // if theme compat is enabled, we're already using our bundled templates 
    971     if ( bp_enable_theme_compat() ) 
     970    // if theme is not bp-default, theme compat is on 
     971    // theme compat already bundles its own templates 
     972    if ( ! bp_is_theme_bp_default() ) 
    972973        return true; 
    973974 
  • trunk/bp-themes/bp-legacy/buddypress-functions.php

    r6399 r6404  
    4747    public function __construct() { 
    4848 
    49         // Bail if theme compat should be disabled 
    50         if ( ! bp_enable_theme_compat() ) 
     49        // Bail if theme is a derivative of bp-default 
     50        if ( bp_is_theme_bp_default() ) 
    5151            return; 
    5252 
Note: See TracChangeset for help on using the changeset viewer.