Skip to:
Content

BuddyPress.org

Changeset 5978


Ignore:
Timestamp:
04/13/2012 12:59:21 PM (13 years ago)
Author:
boonebgorges
Message:

Adds support for WP 3.4 theme functions. Fixes #4098

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/admin/bp-core-functions.php

    r5927 r5978  
    240240
    241241    // Get current theme info
    242     $ct = current_theme_info();
     242    // Backward-compatibility with WP < 3.4 will be removed in a future release
     243    if ( bp_get_major_wp_version() >= 3.4 ) {
     244        $ct = wp_get_theme();
     245    } else {
     246        $ct = current_theme_info();
     247    }
    243248
    244249    // The best way to remove this notice is to add a "buddypress" tag to
  • trunk/bp-core/admin/bp-core-update.php

    r5868 r5978  
    3232        $this->steps = $this->add_steps();
    3333    }
    34    
     34
    3535    function current_step() {
    3636        if ( isset( $_POST['step'] ) ) {
     
    135135
    136136        // Update or Setup
    137         $type = ( 'update' == bp_get_maintenance_mode() ) ? __( 'Update', 'buddypress' ) : __( 'Setup', 'buddypress' ); 
    138        
     137        $type = ( 'update' == bp_get_maintenance_mode() ) ? __( 'Update', 'buddypress' ) : __( 'Setup', 'buddypress' );
     138
    139139        ?>
    140140
     
    341341                <td>
    342342                    <p><label><input type="radio" name="bp_pages[members]" <?php checked( empty( $existing_pages['members'] ) ); ?>  value="<?php echo $members_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $members_slug ); ?>/</label></p>
    343                    
     343
    344344                    <?php if ( $members_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['members']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
    345345
     
    359359                    <td>
    360360                        <p><label><input type="radio" name="bp_pages[groups]" <?php checked( empty( $existing_pages['groups'] ) ); ?>  value="<?php echo $groups_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $groups_slug ); ?>/</label></p>
    361                        
     361
    362362                        <?php if ( $groups_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['groups']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
    363363                            <p><label><input type="radio" name="bp_pages[groups]" <?php checked( !empty( $existing_pages['groups'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $groups_page_dropdown ?></label></p>
     
    378378                    <td>
    379379                        <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( empty( $existing_pages['blogs'] ) ); ?>  value="<?php echo $blogs_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $blogs_slug ); ?>/</label></p>
    380                        
     380
    381381                        <?php if ( $blogs_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['blogs']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
    382382                            <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( !empty( $existing_pages['blogs'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $blogs_page_dropdown ?></label></p>
     
    396396                    <td>
    397397                        <p><label><input type="radio" name="bp_pages[activity]" <?php checked( empty( $existing_pages['activity'] ) ); ?>  value="<?php echo $activity_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activity_slug ); ?>/</label></p>
    398                        
     398
    399399                        <?php if ( $activity_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['activity']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
    400400                            <p><label><input type="radio" name="bp_pages[activity]" <?php checked( !empty( $existing_pages['activity'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activity_page_dropdown ?></label></p>
     
    414414                    <td>
    415415                        <p><label><input type="radio" name="bp_pages[forums]" <?php checked( empty( $existing_pages['forums'] ) ); ?>  value="<?php echo $forums_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $forums_slug ); ?>/</label></p>
    416                        
     416
    417417                        <?php if ( $forums_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['forums']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
    418418                            <p><label><input type="radio" name="bp_pages[forums]" <?php checked( !empty( $existing_pages['forums'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $forums_page_dropdown ?></label></p>
     
    430430                <td>
    431431                    <p><label><input type="radio" name="bp_pages[register]" <?php checked( empty( $existing_pages['register'] ) ); ?>  value="<?php echo $register_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $register_slug ) ?>/</label></p>
    432                    
     432
    433433                    <?php if ( $register_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['register']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
    434434                        <p><label><input type="radio" name="bp_pages[register]" <?php checked( !empty( $existing_pages['register'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $register_page_dropdown ?></label></p>
     
    444444                <td>
    445445                    <p><label><input type="radio" name="bp_pages[activate]" <?php checked( empty( $existing_pages['activate'] ) ); ?>  value="<?php echo $activation_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activation_slug ); ?>/</label></p>
    446                    
     446
    447447                    <?php if ( $activate_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['activate']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
    448448                        <p><label><input type="radio" name="bp_pages[activate]" <?php checked( !empty( $existing_pages['activate'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activate_page_dropdown ?></label></p>
     
    518518
    519519        $installed_plugins = get_plugins();
    520         $installed_themes  = get_themes();
     520
     521        // Backward-compatibility with WP < 3.4 will be removed in a future release
     522        if ( bp_get_major_wp_version() >= 3.4 ) {
     523            $installed_themes = wp_get_themes();
     524        } else {
     525            $installed_themes = get_themes();
     526        }
     527
    521528        $bp_themes         = array();
    522529
     
    540547
    541548        // Get theme screenshot
    542         $current_theme = get_current_theme();
     549        // Backward-compatibility with WP < 3.4 will be removed in a future release
     550        if ( bp_get_major_wp_version() >= 3.4 ) {
     551            $current_theme = wp_get_theme();
     552        } else {
     553            $current_theme = get_current_theme();
     554        }
     555
    543556        $screenshot    = '';
    544         $themes        = get_themes();
    545 
    546         if ( !empty( $themes[$current_theme]['Screenshot'] ) ) {
    547             $screenshot = trailingslashit( get_stylesheet_directory_uri() ) . $themes[$current_theme]['Screenshot'];
     557
     558        if ( !empty( $installed_themes[$current_theme]['Screenshot'] ) ) {
     559            $screenshot = trailingslashit( get_stylesheet_directory_uri() ) . $installad_themes[$current_theme]['Screenshot'];
    548560        } ?>
    549561
     
    882894    function step_theme_save() {
    883895        global $bp;
    884        
     896
    885897        if ( isset( $_POST['submit'] ) && isset( $_POST['theme'] ) ) {
    886898            check_admin_referer( 'bpwizard_theme' );
     
    10331045    function reset_cookie() {
    10341046        @setcookie( 'bp-wizard-step', '', time() - 3600, COOKIEPATH );
    1035     }   
     1047    }
    10361048}
    10371049
     
    10401052 *
    10411053 * @global type $bp
    1042  * @return boolean 
     1054 * @return boolean
    10431055 */
    10441056function bp_get_wizard() {
  • trunk/bp-core/bp-core-wpabstraction.php

    r5977 r5978  
    1111// Exit if accessed directly
    1212if ( !defined( 'ABSPATH' ) ) exit;
     13
     14/**
     15 * Parse the WordPress core version number into the major release
     16 *
     17 * @since BuddyPress (1.5.2)
     18 * @global string $wp_version
     19 * @return string
     20 */
     21function bp_get_major_wp_version() {
     22    global $wp_version;
     23
     24    return (float) $wp_version;
     25}
    1326
    1427/**
  • trunk/bp-themes/bp-default/functions.php

    r5927 r5978  
    8888
    8989    // This theme allows users to set a custom background
    90     add_custom_background( 'bp_dtheme_custom_background_style' );
     90    // Backward-compatibility with WP < 3.4 will be removed in a future release
     91    if ( bp_get_major_wp_version() >= 3.4 ) {
     92        $custom_background_args = array(
     93            'wp-head-callback' => 'bp_dtheme_custom_background_style'
     94        );
     95        add_theme_support( 'custom-background', $custom_background_args );
     96    } else {
     97        add_custom_background( 'bp_dtheme_custom_background_style' );
     98    }
    9199
    92100    // Add custom header support if allowed
     
    104112
    105113        // Add a way for the custom header to be styled in the admin panel that controls custom headers.
    106         add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
     114        // Backward-compatibility with WP < 3.4 will be removed in a future release
     115        if ( bp_get_major_wp_version() >= 3.4 ) {
     116            $custom_header_args = array(
     117                'wp-head-callback' => 'bp_dtheme_header_style',
     118                'admin-head-callback' => 'bp_dtheme_admin_header_style'
     119            );
     120            add_theme_support( 'custom-header', $custom_header_args );
     121        } else {
     122            add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
     123        }
    107124    }
    108125
Note: See TracChangeset for help on using the changeset viewer.