Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/08/2011 06:46:09 PM (15 years ago)
Author:
djpaul
Message:

Switch to use the WP Admin Bar by default. See #3661

File:
1 edited

Legend:

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

    r5202 r5223  
    8585                                $steps[] = __( 'Database Update', 'buddypress' );
    8686
     87                        // New for BP 1.5
    8788                        if ( $this->database_version < 1801 || !bp_core_get_directory_page_ids() ) {
    8889                                $steps[] = __( 'Components', 'buddypress' );
    … …  
    9091                        }
    9192
     93                        // New for BP 1.6
     94                        if ( $this->database_version < 5222 && !defined( 'BP_USE_WP_ADMIN_BAR' ) )
     95                                $steps[] = __( 'Admin Bar', 'buddypress' );
     96
    9297                        $steps[] = __( 'Finish', 'buddypress' );
    9398                }
    … …  
    100105                // Save any posted values
    101106                switch ( $step_name ) {
    102                         case 'db_update': default:
     107                        case 'db_update':
    103108                                $result = $this->step_db_update_save();
    104109                                break;
    105110
    106                         case 'ms_update': default:
     111                        case 'ms_update':
    107112                                $result = $this->step_ms_update_save();
    108113                                break;
    109114
    110                         case 'ms_pages': default:
     115                        case 'ms_pages':
    111116                                $result = $this->step_ms_update_save();
    112117                                break;
    113118
    114                         case 'components': default:
     119                        case 'components':
    115120                                $result = $this->step_components_save();
    116121                                break;
    117122
    118                         case 'pages': default:
     123                        case 'pages':
    119124                                $result = $this->step_pages_save();
    120125                                break;
    121126
    122                         case 'permalinks': default:
     127                        case 'permalinks':
    123128                                $result = $this->step_permalinks_save();
    124129                                break;
    125130
    126                         case 'theme': default:
     131                        case 'theme':
    127132                                $result = $this->step_theme_save();
    128133                                break;
    129134
    130                         case 'finish': default:
     135                        case 'admin_bar':
     136                                $result = $this->step_admin_bar_save();
     137                                break;
     138
     139                        case 'finish':
     140                        default:
    131141                                $result = $this->step_finish_save();
    132142                                break;
    … …  
    233243                                                        break;
    234244
     245                                                case __( 'Admin Bar', 'buddypress' ) :
     246                                                        $this->step_admin_bar();
     247                                                        break;
     248
    235249                                                case __( 'Finish', 'buddypress') :
    236250                                                        $this->step_finish();
    237251                                                        break;
    238 
    239252                                        } ?>
    240253
    … …  
    730743        }
    731744
     745        /**
     746         * When upgrading to BP 1.6, prompt the admin to switch to WordPress' admin bar.
     747         *
     748         * @since 1.6
     749         */
     750        function step_admin_bar() {
     751                if ( !current_user_can( 'activate_plugins' ) )
     752                        return false;
     753                ?>
     754
     755                <p><?php _e( "BuddyPress now uses WordPress' Admin Bar; this sits at the top of your site and contains various links to useful admin screens. We've turbo-charged the Admin Bar by adding social items to help your users explore your site, and manage their content.", 'buddypress' ); ?></p>
     756
     757                <p><?php _e( "We've noticed that your site uses the old bar from earlier versions of BuddyPress.", 'buddypress' ); ?></p>
     758
     759                <p>
     760                        <label>
     761                                <input type="checkbox" name="keep_buddybar" value="1" />
     762                                <?php _e( "If you'd prefer to not switch to the WordPress Admin bar just yet, check this box. Don't worry, you can change your mind later.", 'buddypress' ); ?>
     763                        </label>
     764                </p>
     765
     766                <div class="submit clear">
     767                        <input type="hidden" name="save" value="admin_bar" />
     768                        <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" />
     769
     770                        <?php wp_nonce_field( 'bpwizard_admin_bar' ) ?>
     771                </div>
     772
     773                <?php
     774        }
     775
    732776        function step_finish() {
    733777                if ( !current_user_can( 'activate_plugins' ) )
    … …  
    10161060                        if ( is_multisite() )
    10171061                                restore_current_blog();
     1062
     1063                        return true;
     1064                }
     1065
     1066                return false;
     1067        }
     1068
     1069        /**
     1070         * When upgrading to BP 1.6, the admin is prompted to switch to WordPress' admin bar.
     1071         * If they choose not to, record that preference in the options table.
     1072         *
     1073         * @since 1.6
     1074         */
     1075        function step_admin_bar_save() {
     1076                if ( isset( $_POST['submit'] ) ) {
     1077                        check_admin_referer( 'bpwizard_admin_bar' );
     1078
     1079                        if ( !empty( $_POST['keep_buddybar'] ) )
     1080                                bp_update_option( 'bp-force-buddybar', 1 );
    10181081
    10191082                        return true;
Note: See TracChangeset for help on using the changeset viewer.