Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/13/2012 06:20:07 PM (14 years 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().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.