Skip to:
Content

BuddyPress.org

Changeset 5749


Ignore:
Timestamp:
02/13/2012 04:03:55 AM (14 years ago)
Author:
johnjamesjacoby
Message:

First pass at refactoring update/install wizard to remove code duplication:

  • Rename and move admin images, css, and js into bp-core/admin/ folders
  • Load the wizard from inside BP_Admin instead of selectively alone, so that basic functions are available
  • Properly enqueue admin scripts
  • Remove duplicated _update_ functions in bp-core-updater.php
  • Remove weird redirect hack as it's no longer needed
  • Remove purpose built functions that are no longer needed
  • See #4005.
  • Indirectly fixes #3964.
Location:
trunk
Files:
5 added
1 deleted
10 edited
9 moved

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-admin.php

    r5739 r5749  
    3535
    3636        // Hook into early actions to load custom CSS and our init handler.
    37         add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' );
    3837        add_action( "load-$hook", 'bp_activity_admin_load' );
    3938}
  • trunk/bp-core/admin/bp-core-components.php

    r5683 r5749  
    5252 */
    5353function bp_core_admin_components_options() {
    54         global $bp_wizard;
    5554
    5655        // Load core functions, if needed
     
    131130
    132131        // On new install, set all components to be active by default
    133         if ( !empty( $bp_wizard ) && 'install' == $bp_wizard->setup_type && empty( $active_components ) )
     132        if ( empty( $active_components ) && ( bp_get_maintenance_mode() == 'install' ) )
    134133                $active_components = $optional_components;
    135134
    136         ?>
    137 
    138         <?php /* The setup wizard uses different, more descriptive text here */ ?>
    139         <?php if ( empty( $bp_wizard ) ) : ?>
     135        // The setup wizard uses different, more descriptive text
     136        if ( bp_get_maintenance_mode() ) : ?>
    140137
    141138                <h3><?php _e( 'Available Components', 'buddypress' ); ?></h3>
     
    169166        </table>
    170167
    171         <?php if ( empty( $bp_wizard ) ) : ?>
     168        <?php if ( bp_get_maintenance_mode() ) : ?>
    172169
    173170                <h3><?php _e( 'Required Components', 'buddypress' ); ?></h3>
  • trunk/bp-core/admin/bp-core-functions.php

    r5739 r5749  
    332332
    333333/**
    334  * Loads admin panel styles and scripts.
    335  *
    336  * @package BuddyPress Core
    337  * @since {@internal Unknown}}
    338  */
    339 function bp_core_add_admin_menu_styles() {
    340         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
    341                 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', BP_PLUGIN_URL . 'bp-core/css/admin.dev.css' ), array(), '20110723' );
    342         else
    343                 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', BP_PLUGIN_URL . 'bp-core/css/admin.css' ), array(), '20110723' );
    344 
    345         wp_enqueue_script( 'thickbox' );
    346         wp_enqueue_style( 'thickbox' );
    347 }
    348 
    349 /**
    350334 * Output the tabs in the admin area
    351335 *
     
    363347        $tabs = array(
    364348                '0' => array(
    365                         'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
     349                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components'    ), 'admin.php' ) ),
    366350                        'name' => __( 'Components', 'buddypress' )
    367351                ),
    368352                '1' => array(
    369                         'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings'      ), 'admin.php' ) ),
     353                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ),
    370354                        'name' => __( 'Permalinks', 'buddypress' )
    371355                ),
    372356                '2' => array(
    373                         'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings'   ), 'admin.php' ) ),
     357                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings'      ), 'admin.php' ) ),
    374358                        'name' => __( 'Settings',   'buddypress' )
    375359                )
     
    379363        if ( bp_is_active( 'forums' ) ) {
    380364                $tabs['3'] = array(
    381                         'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bb-forums-setup' ), 'admin.php' ) ),
     365                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bb-forums-setup'  ), 'admin.php' ) ),
    382366                        'name' => __( 'Forums', 'buddypress' )
    383367                );
  • trunk/bp-core/admin/bp-core-schema.php

    r5683 r5749  
    11<?php
     2
    23// Exit if accessed directly
    34if ( !defined( 'ABSPATH' ) ) exit;
     
    1314
    1415        return '';
     16}
     17
     18function bp_core_install( $active_components = false ) {
     19
     20        if ( empty( $active_components ) )
     21                $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
     22
     23        // Core DB Tables
     24        bp_core_install_notifications();
     25
     26        // Activity Streams
     27        if ( !empty( $active_components['activity'] ) )
     28                bp_core_install_activity_streams();
     29
     30        // Friend Connections
     31        if ( !empty( $active_components['friends'] ) )
     32                bp_core_install_friends();
     33
     34        // Extensible Groups
     35        if ( !empty( $active_components['groups'] ) )
     36                bp_core_install_groups();
     37
     38        // Private Messaging
     39        if ( !empty( $active_components['messages'] ) )
     40                bp_core_install_private_messaging();
     41
     42        // Extended Profiles
     43        if ( !empty( $active_components['xprofile'] ) )
     44                bp_core_install_extended_profiles();
     45
     46        // Blog tracking
     47        if ( !empty( $active_components['blogs'] ) )
     48                bp_core_install_blog_tracking();
    1549}
    1650
     
    301335}
    302336
     337/**
     338 * I don't appear to be used anymore, but I'm here anyways. I was originally
     339 * used in olden days to update pre-1.1 schemas, but that was before we had
     340 * a legitimate update process. Keep me around just incase.
     341 *
     342 * @global WPDB $wpdb
     343 * @global BuddyPress $bp
     344 */
     345function bp_update_db_stuff() {
     346        global $wpdb, $bp;
     347
     348        $bp_prefix = bp_core_get_table_prefix();
     349
     350        // Rename the old user activity cached table if needed.
     351        if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp_prefix}bp_activity_user_activity_cached%'" ) )
     352                $wpdb->query( "RENAME TABLE {$bp_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" );
     353
     354        // Rename fields from pre BP 1.2
     355        if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->activity->table_name}%'" ) ) {
     356                if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_action'" ) ) {
     357                        $wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component_action type varchar(75) NOT NULL" );
     358                }
     359
     360                if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_name'" ) ) {
     361                        $wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component_name component varchar(75) NOT NULL" );
     362                }
     363        }
     364
     365        // On first installation - record all existing blogs in the system.
     366        if ( !(int) $bp->site_options['bp-blogs-first-install'] ) {
     367                bp_blogs_record_existing_blogs();
     368                bp_update_option( 'bp-blogs-first-install', 1 );
     369        }
     370
     371        if ( is_multisite() ) {
     372                bp_core_add_illegal_names();
     373        }
     374
     375        // Update and remove the message threads table if it exists
     376        if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp_prefix}bp_messages_threads%'" ) ) {
     377                if ( BP_Messages_Thread::update_tables() ) {
     378                        $wpdb->query( "DROP TABLE {$bp_prefix}bp_messages_threads" );
     379                }
     380        }
     381
     382}
     383
    303384?>
  • trunk/bp-core/admin/bp-core-update.php

    r5739 r5749  
    1616        var $steps;
    1717
    18         /**
    19          * @var int Database version of current BuddyPress files
    20          */
    21         var $db_version;
    22 
    23         /**
    24          * @var int Database version raw from the database connection
    25          */
    26         var $db_version_raw;
    27 
    28         /**
    29          * @var string What kind of setup/update are we performing
    30          */
    31         var $setup_type;
    32 
    33         /** Functions *************************************************************/
    34 
    35         function bp_core_setup_wizard() {
    36                 $this->__construct();
    37         }
     18        /** Methods ***************************************************************/
    3819
    3920        function __construct() {
    40                 global $bp;
    4121
    4222                // Ensure that we have access to some utility functions. Must use require_once()
     
    4424                require_once( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php' );
    4525
    46                 // Get current DB version
    47                 $this->db_version_raw = !empty( $bp->db_version_raw ) ? (int) $bp->db_version_raw : 0;
    48 
     26                // Set/reset the wizard cookie
    4927                setcookie( 'bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH );
    5028                $_COOKIE['bp-wizard-step'] = 0;
    51 
    52                 $this->db_version   = bp_get_db_version();
    53                 $this->setup_type   = $bp->maintenance_mode;
    54                 $this->current_step = $this->current_step();
    55 
    56                 // Remove the admin menu while we update/install
    57                 remove_action( bp_core_admin_hook(), 'bp_core_add_admin_menu', 9 );
    5829
    5930                // Call the save method that will save data and modify $current_step
     
    6435                $this->steps = $this->add_steps();
    6536        }
    66 
     37       
    6738        function current_step() {
    6839                if ( isset( $_POST['step'] ) ) {
     
    8455                $steps = array();
    8556
    86                 if ( 'install' == $this->setup_type ) {
     57                if ( bp_get_maintenance_mode() == 'install' ) {
    8758                        $steps = array(
    8859                                __( 'Components', 'buddypress' ),
     
    9667                } else {
    9768
    98                         if ( $this->db_version_raw < (int) $this->db_version )
     69                        if ( bp_get_db_version_raw() < (int) bp_get_db_version() )
    9970                                $steps[] = __( 'Database Update', 'buddypress' );
    10071
    10172                        // New for BP 1.5
    102                         if ( $this->db_version_raw < 1801 || !bp_core_get_directory_page_ids() ) {
     73                        if ( bp_get_db_version_raw() < 1801 || !bp_core_get_directory_page_ids() ) {
    10374                                $steps[] = __( 'Components', 'buddypress' );
    10475                                $steps[] = __( 'Pages',      'buddypress' );
     
    10677
    10778                        // New for BP 1.6
    108                         if ( $this->db_version_raw < 5222 && !defined( 'BP_USE_WP_ADMIN_BAR' ) )
     79                        if ( bp_get_db_version_raw() < 5222 && !defined( 'BP_USE_WP_ADMIN_BAR' ) )
    10980                                $steps[] = __( 'Admin Bar', 'buddypress' );
    11081
     
    11687
    11788        function save( $step_name ) {
     89
     90                // Bail if user is not capable of being here
     91                if ( ! bp_current_user_can( 'activate_plugins' ) )
     92                        wp_die( 'Uh... No.' );
    11893
    11994                // Save any posted values
     
    149124                }
    150125
    151                 if ( !$result && $this->current_step )
    152                         $this->current_step--;
    153 
    154126                if ( 'finish' != $step_name )
    155                         setcookie( 'bp-wizard-step', (int) $this->current_step, time() + 60 * 60 * 24, COOKIEPATH );
     127                        setcookie( 'bp-wizard-step', (int) $this->current_step(), time() + 60 * 60 * 24, COOKIEPATH );
    156128        }
    157129
    158130        function html() {
    159131
     132                // Bail if user is not capable of being here
     133                if ( ! bp_current_user_can( 'activate_plugins' ) )
     134                        wp_die( 'You do not have sufficient permissions to access this page.' );
     135
    160136                // Update or Setup
    161                 $type = ( 'update' == $this->setup_type ) ? __( 'Update', 'buddypress' ) : __( 'Setup', 'buddypress' );
    162 
     137                $type = ( 'update' == bp_get_maintenance_mode() ) ? __( 'Update', 'buddypress' ) : __( 'Setup', 'buddypress' );
     138               
    163139                ?>
    164140
    165                 <div class="wrap" id="bp-admin">
     141                <div class="wrap" id="bp-wizard">
    166142
    167143                        <?php screen_icon( 'buddypress' ); ?>
     
    173149
    174150                                $step_count  = count( $this->steps ) - 1;
    175                                 $wiz_or_set  = $this->current_step >= $step_count ? 'bp-components' : 'bp-wizard';
    176                                 $form_action = bp_core_update_do_network_admin() ? network_admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) );
     151                                $wiz_or_set  = $this->current_step() >= $step_count ? 'bp-components' : 'bp-wizard';
     152                                $form_action = bp_core_do_network_admin() ? network_admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'index.php' ) );
    177153                        ?>
    178154
    179                         <form action="<?php echo $form_action; ?>" method="post" id="bp-admin-form">
    180                                 <div id="bp-admin-nav">
     155                        <form action="<?php echo $form_action; ?>" method="post" id="bp-wizard-form">
     156                                <div id="bp-wizard-nav">
    181157                                        <ol>
    182158
    183159                                                <?php foreach( (array) $this->steps as $i => $name ) : ?>
    184160
    185                                                         <li<?php if ( $this->current_step == $i ) : ?> class="current"<?php endif; ?>>
    186                                                                 <?php if ( $this->current_step > $i ) : ?>
     161                                                        <li<?php if ( $this->current_step() == $i ) : ?> class="current"<?php endif; ?>>
     162                                                                <?php if ( $this->current_step() > $i ) : ?>
    187163
    188164                                                                        <span class="complete">&nbsp;</span>
     
    202178                                        </ol>
    203179
    204                                         <?php if ( __( 'Finish', 'buddypress' ) == $this->steps[$this->current_step] ) : ?>
     180                                        <?php if ( __( 'Finish', 'buddypress' ) == $this->steps[$this->current_step()] ) : ?>
    205181
    206182                                                <div class="prev-next submit clear">
     
    218194                                </div>
    219195
    220                                 <div id="bp-admin-content">
    221 
    222                                         <?php switch ( $this->steps[$this->current_step] ) {
     196                                <div id="bp-wizard-content">
     197
     198                                        <?php switch ( $this->steps[$this->current_step()] ) {
    223199                                                case __( 'Database Update', 'buddypress') :
    224200                                                        $this->step_db_update();
     
    260236
    261237        function step_db_update() {
    262                 if ( !current_user_can( 'activate_plugins' ) )
    263                         return false; ?>
     238        ?>
    264239
    265240                <p><?php _e( 'Before you can continue using BuddyPress, a few minor adjustments need to be made. These changes are not destructive and will not remove or change any existing settings.', 'buddypress' ); ?></p>
     
    267242                <div class="submit clear">
    268243                        <input type="hidden" name="save" value="db_update" />
    269                         <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" />
     244                        <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />
    270245
    271246                        <?php wp_nonce_field( 'bpwizard_db_update' ) ?>
     
    277252
    278253        function step_components() {
    279                 if ( !current_user_can( 'activate_plugins' ) )
    280                         return false;
    281254
    282255                if ( !function_exists( 'bp_core_admin_components_options' ) )
     
    289262                <div class="submit clear">
    290263                        <input type="hidden" name="save" value="components" />
    291                         <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" />
     264                        <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />
    292265
    293266                        <?php wp_nonce_field( 'bpwizard_components' ); ?>
     
    306279                        switch_to_blog( bp_get_root_blog_id() );
    307280
    308                 if ( !current_user_can( 'activate_plugins' ) )
    309                         return false;
    310 
    311                 $existing_pages = bp_core_update_get_page_meta();
     281                $existing_pages = bp_core_get_directory_page_ids();
    312282
    313283                // Provide empty indexes to avoid PHP errors with wp_dropdown_pages()
     
    484454                <div class="submit clear">
    485455                        <input type="hidden" name="save" value="pages" />
    486                         <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" />
     456                        <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />
    487457
    488458                        <?php wp_nonce_field( 'bpwizard_pages' ); ?>
     
    496466
    497467        function step_permalinks() {
    498                 if ( !current_user_can( 'activate_plugins' ) )
    499                         return false;
    500468
    501469                $prefix              = '';
     
    532500                <div class="submit clear">
    533501                        <input type="hidden" name="save" value="permalinks" />
    534                         <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" />
     502                        <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />
    535503
    536504                        <?php if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && empty( $_POST['skip-htaccess'] ) ) : ?>
     
    548516
    549517        function step_theme() {
    550                 if ( !current_user_can( 'activate_plugins' ) )
    551                         return false;
    552518
    553519                $installed_plugins = get_plugins();
     
    603569                        </tr>
    604570
    605                         <?php if ( $bp_theme_installed ) : ?>
     571                        <?php if ( !empty( $bp_theme_installed ) ) : ?>
     572
    606573                                <tr>
    607574                                        <th>
    608575                                                <h5><?php _e( 'Other themes', 'buddypress' ); ?></h5>
    609                                                 <img src="<?php echo plugins_url( '/buddypress/bp-core/images/find.png' ); ?>" alt="<?php _e( 'A BuddyPress theme', 'buddypress' ); ?>" />
     576                                                <img src="<?php echo plugins_url( '/buddypress/bp-core/admin/images/find.png' ); ?>" alt="<?php _e( 'A BuddyPress theme', 'buddypress' ); ?>" />
    610577                                        </th>
    611578                                        <td>
     
    627594                                        </td>
    628595                                </tr>
     596
    629597                        <?php endif; ?>
    630598
    631                         <tr>
    632                                 <th>
    633                                         <h5><?php _e( 'Manually update current theme', 'buddypress' ); ?></h5>
    634 
    635                                         <?php if ( !empty( $screenshot ) ) : ?>
    636 
    637                                                 <img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php _e( 'Your existing theme', 'buddypress' ); ?>" />
    638 
    639                                         <?php endif; ?>
    640 
    641                                 </th>
    642                                 <td>
    643                                         <p><?php _e( 'The BuddyPress Template Pack will guide you through the process of manually editing your existing theme. It comes with a step-by-step guide and involves copying the BuddyPress template files into your theme. <strong>This option requires knowledge of CSS and HTML.</strong> You will need to tweak the new templates to match your existing theme.', 'buddypress' ); ?></p>
    644 
    645                                         <?php if ( empty( $template_pack_installed ) ) : ?>
    646 
    647                                                 <p><a id="bp-template-pack" class="thickbox onclick button" href="<?php echo network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=bp-template-pack&TB_iframe=true&width=640&height=500' ); ?>"><?php _e( 'Install BuddyPress Template Pack', 'buddypress' ); ?></a></p>
    648 
    649                                         <?php else : ?>
    650 
    651                                                 <p><label><input type="radio" name="theme" value="manual_wp" /> <?php _e( 'Choose this option (go to Appearance &rarr; BP Compatibility after setup is complete)', 'buddypress' ); ?></label></p>
    652                                                 <p><a id="bp-template-pack" class="button installed disabled" href="javascript:void();"><span></span><?php _e( 'Plugin Installed', 'buddypress' ); ?></a></p>
    653 
    654                                         <?php endif; ?>
    655 
    656                                 </td>
    657                         </tr>
     599                        <?php if ( ! current_theme_supports( 'buddypress' ) ) : ?>
     600
     601                                <tr>
     602                                        <th>
     603                                                <h5><?php _e( 'Manually update current theme', 'buddypress' ); ?></h5>
     604
     605                                                <?php if ( !empty( $screenshot ) ) : ?>
     606
     607                                                        <img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php _e( 'Your existing theme', 'buddypress' ); ?>" />
     608
     609                                                <?php endif; ?>
     610
     611                                        </th>
     612                                        <td>
     613                                                <p><?php _e( 'The BuddyPress Template Pack will guide you through the process of manually editing your existing theme. It comes with a step-by-step guide and involves copying the BuddyPress template files into your theme. <strong>This option requires knowledge of CSS and HTML.</strong> You will need to tweak the new templates to match your existing theme.', 'buddypress' ); ?></p>
     614
     615                                                <?php if ( empty( $template_pack_installed ) ) : ?>
     616
     617                                                        <p><a id="bp-template-pack" class="thickbox onclick button" href="<?php echo network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=bp-template-pack&TB_iframe=true&width=640&height=500' ); ?>"><?php _e( 'Install BuddyPress Template Pack', 'buddypress' ); ?></a></p>
     618
     619                                                <?php else : ?>
     620
     621                                                        <p><label><input type="radio" name="theme" value="manual_wp" /> <?php _e( 'Choose this option (go to Appearance &rarr; BP Compatibility after setup is complete)', 'buddypress' ); ?></label></p>
     622                                                        <p><a id="bp-template-pack" class="button installed disabled" href="javascript:void();"><span></span><?php _e( 'Plugin Installed', 'buddypress' ); ?></a></p>
     623
     624                                                <?php endif; ?>
     625
     626                                        </td>
     627                                </tr>
     628
     629                        <?php endif; ?>
    658630
    659631                        <tr>
     
    673645                <div class="submit clear">
    674646                        <input type="hidden" name="save" value="theme" />
    675                         <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ) ?>" />
     647                        <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ) ?>" />
    676648
    677649                        <?php wp_nonce_field( 'bpwizard_theme' ) ?>
     
    688660         */
    689661        function step_admin_bar() {
    690                 if ( !current_user_can( 'activate_plugins' ) )
    691                         return false;
    692                 ?>
     662        ?>
    693663
    694664                <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>
     
    705675                <div class="submit clear">
    706676                        <input type="hidden" name="save" value="admin_bar" />
    707                         <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" />
     677                        <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />
    708678
    709679                        <?php wp_nonce_field( 'bpwizard_admin_bar' ) ?>
     680
    710681                </div>
    711682
     
    714685
    715686        function step_finish() {
    716                 if ( !current_user_can( 'activate_plugins' ) )
    717                         return false;
    718687
    719688                // What type of action is happening here?
    720                 $type = ( 'install' == $this->setup_type ) ? __( 'setup', 'buddypress' ) : __( 'update', 'buddypress' ); ?>
    721 
    722                 <p><?php printf( __( "The BuddyPress %1\$s is complete, and your site is ready to go!", 'buddypress' ), $type, $type ); ?></p>
     689                $type = ( bp_get_maintenance_mode() == 'install' ) ? __( 'setup', 'buddypress' ) : __( 'update', 'buddypress' ); ?>
     690
     691                <p><?php printf( __( "The BuddyPress %1\$s is complete, and your site is ready to go!", 'buddypress' ), $type ); ?></p>
    723692
    724693                <div class="submit clear">
    725694                        <input type="hidden" name="save" value="finish" />
    726                         <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" />
     695                        <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />
    727696
    728697                        <?php wp_nonce_field( 'bpwizard_finish' ); ?>
     
    736705
    737706        function step_db_update_save() {
    738                 global $bp;
    739707
    740708                if ( isset( $_POST['submit'] ) ) {
     
    744712                        bp_core_install();
    745713
    746                         if ( $this->db_version_raw < 1801 )
     714                        // Update to 1.5
     715                        if ( bp_get_db_version_raw() < 1801 )
    747716                                $this->update_1_5();
    748717
    749                         // Update the active components option early if we're updating
    750                         if ( 'update' == $this->setup_type )
    751                                 bp_update_option( 'bp-active-components', $bp->active_components );
     718                        // Update to 1.6
     719                        if ( bp_get_db_version_raw() < bp_get_db_version() )
     720                                $this->update_1_6();
    752721
    753722                        return true;
     
    792761
    793762                        // Delete any existing pages
    794                         $existing_pages = bp_core_update_get_page_meta( 'bp-pages' );
     763                        $existing_pages = bp_core_get_directory_page_ids();
    795764
    796765                        foreach ( (array) $existing_pages as $page_id ) {
     
    992961                        check_admin_referer( 'bpwizard_finish' );
    993962
    994                         // Delete possible site options
    995                         delete_site_option( 'bp-db-version'       );
    996                         delete_site_option( '_bp_db_version'      );
    997                         delete_site_option( 'bp-core-db-version'  );
    998                         delete_site_option( '_bp-core-db-version' );
    999 
    1000                         // Delete possible blog options
    1001                         delete_blog_option( bp_get_root_blog_id(), 'bp-db-version'       );
    1002                         delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version'  );
    1003                         delete_site_option( bp_get_root_blog_id(), '_bp-core-db-version' );
    1004                         delete_site_option( bp_get_root_blog_id(), '_bp_db_version'      );
    1005 
    1006963                        // Update the DB version in the database
    1007964                        // Stored in sitemeta. Do not use bp_update_option()
    1008                         update_blog_option( bp_get_root_blog_id(), '_bp_db_version', $this->db_version );
     965                        update_blog_option( bp_get_root_blog_id(), '_bp_db_version', bp_get_db_version() );
    1009966
    1010967                        // Delete the setup cookie
    1011968                        @setcookie( 'bp-wizard-step', '', time() - 3600, COOKIEPATH );
    1012969
    1013                         // Load BP and hook the admin menu, so that the redirect is successful
    1014                         require_once( WP_PLUGIN_DIR . '/buddypress/bp-core/bp-core-admin.php' );
    1015                         require_once( WP_PLUGIN_DIR . '/buddypress/bp-core/bp-core-template.php' );
    1016                         bp_admin();
    1017 
    1018970                        // Redirect to the BuddyPress dashboard
    1019                         $redirect = bp_core_update_do_network_admin() ? add_query_arg( array( 'page' => 'bp-components' ), network_admin_url( 'settings.php' ) ) : add_query_arg( array( 'page' => 'bp-components' ), admin_url( 'options-general.php' ) );
     971                        $redirect = bp_core_do_network_admin() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
     972                        $redirect = add_query_arg( array( 'page' => 'bp-components' ), $redirect  );
    1020973
    1021974                        wp_safe_redirect( $redirect );
    1022975
    1023                         return true;
     976                        // That's all!
     977                        exit();
    1024978                }
    1025979
     
    10491003        // Database update methods based on version numbers
    10501004        function update_1_5() {
     1005
    10511006                // Delete old database version options
    10521007                delete_site_option( 'bp-activity-db-version' );
     
    10581013        }
    10591014
     1015        // Database update methods based on version numbers
     1016        function update_1_6() {
     1017
     1018                // Delete possible site options
     1019                delete_site_option( 'bp-db-version'       );
     1020                delete_site_option( '_bp_db_version'      );
     1021                delete_site_option( 'bp-core-db-version'  );
     1022                delete_site_option( '_bp-core-db-version' );
     1023
     1024                // Delete possible blog options
     1025                delete_blog_option( bp_get_root_blog_id(), 'bp-db-version'       );
     1026                delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version'  );
     1027                delete_site_option( bp_get_root_blog_id(), '_bp-core-db-version' );
     1028                delete_site_option( bp_get_root_blog_id(), '_bp_db_version'      );
     1029        }
     1030
    10601031        /**
    10611032         * Reset the cookie so the install script starts over
     
    10631034        function reset_cookie() {
    10641035                @setcookie( 'bp-wizard-step', '', time() - 3600, COOKIEPATH );
    1065         }
     1036        }       
    10661037}
    10671038
    1068 function bp_core_setup_wizard_init() {
    1069         global $bp_wizard;
    1070 
    1071         $bp_wizard = new BP_Core_Setup_Wizard;
     1039/**
     1040 * Get the wizard
     1041 *
     1042 * @global type $bp
     1043 * @return boolean
     1044 */
     1045function bp_get_wizard() {
     1046        global $bp;
     1047
     1048        if ( !empty( $bp->admin->wizard ) )
     1049                return $bp->admin->wizard;
     1050
     1051        return false;
    10721052}
    1073 add_action( bp_core_update_admin_hook(), 'bp_core_setup_wizard_init', 7 );
    1074 
    1075 function bp_core_install( $active_components = false ) {
    1076 
    1077         if ( empty( $active_components ) )
    1078                 $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
    1079 
    1080         require( dirname( __FILE__ ) . '/bp-core-schema.php' );
    1081 
    1082         // Core DB Tables
    1083         bp_core_install_notifications();
    1084 
    1085         // Activity Streams
    1086         if ( !empty( $active_components['activity'] ) )
    1087                 bp_core_install_activity_streams();
    1088 
    1089         // Friend Connections
    1090         if ( !empty( $active_components['friends'] ) )
    1091                 bp_core_install_friends();
    1092 
    1093         // Extensible Groups
    1094         if ( !empty( $active_components['groups'] ) )
    1095                 bp_core_install_groups();
    1096 
    1097         // Private Messaging
    1098         if ( !empty( $active_components['messages'] ) )
    1099                 bp_core_install_private_messaging();
    1100 
    1101         // Extended Profiles
    1102         if ( !empty( $active_components['xprofile'] ) )
    1103                 bp_core_install_extended_profiles();
    1104 
    1105         // Blog tracking
    1106         if ( !empty( $active_components['blogs'] ) )
    1107                 bp_core_install_blog_tracking();
    1108 }
    1109 
    1110 function bp_core_update( $disabled ) {
    1111         require( dirname( __FILE__ ) . '/bp-core-schema.php' );
    1112 }
    1113 
    1114 function bp_update_db_stuff() {
    1115         $bp_prefix = bp_core_get_table_prefix();
    1116         // Rename the old user activity cached table if needed.
    1117         if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp_prefix}bp_activity_user_activity_cached%'" ) )
    1118                 $wpdb->query( "RENAME TABLE {$bp_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" );
    1119 
    1120         // Rename fields from pre BP 1.2
    1121         if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->activity->table_name}%'" ) ) {
    1122                 if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_action'" ) )
    1123                         $wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component_action type varchar(75) NOT NULL" );
    1124 
    1125                 if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_name'" ) )
    1126                         $wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component_name component varchar(75) NOT NULL" );
    1127         }
    1128 
    1129         // On first installation - record all existing blogs in the system.
    1130         if ( !(int) $bp->site_options['bp-blogs-first-install'] ) {
    1131                 bp_blogs_record_existing_blogs();
    1132                 bp_update_option( 'bp-blogs-first-install', 1 );
    1133         }
    1134 
    1135         if ( is_multisite() )
    1136                 bp_core_add_illegal_names();
    1137 
    1138         // Update and remove the message threads table if it exists
    1139         if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp_prefix}bp_messages_threads%'" ) ) {
    1140                 $update = BP_Messages_Thread::update_tables();
    1141 
    1142                 if ( $update )
    1143                         $wpdb->query( "DROP TABLE {$bp_prefix}bp_messages_threads" );
    1144         }
    1145 
    1146 }
    1147 
    1148 function bp_core_wizard_message() {
    1149         if ( isset( $_GET['updated'] ) )
    1150                 $message = __( 'Installation was successful. The available options have now been updated, please continue with your selection.', 'buddypress' );
    1151         else
    1152                 return false; ?>
    1153 
    1154         <div id="message" class="updated">
    1155                 <p><?php echo esc_attr( $message ) ?></p>
    1156         </div>
    1157 
    1158 <?php
    1159 }
    1160 add_action( 'bp_admin_notices', 'bp_core_wizard_message' );
    1161 
    1162 // Alter thickbox screens so the entire plugin download and install
    1163 // interface is contained within.
    1164 function bp_core_wizard_thickbox() {
    1165         $form_action = bp_core_update_do_network_admin() ? network_admin_url( add_query_arg( array( 'page' => 'bp-wizard', 'updated' => '1' ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => 'bp-wizard', 'updated' => '1' ), 'admin.php' ) ); ?>
    1166 
    1167         <script type="text/javascript">
    1168                 jQuery('p.action-button a').attr( 'target', '' );
    1169 
    1170                 if ( window.location != window.parent.location ) {
    1171                         jQuery('#adminmenu, #wphead, #footer, #update-nag, #screen-meta').hide();
    1172                         jQuery('#wpbody').css( 'margin', '15px' );
    1173                         jQuery('body').css( 'min-width', '30px' );
    1174                         jQuery('#wpwrap').css( 'min-height', '30px' );
    1175                         jQuery('a').removeClass( 'thickbox thickbox-preview onclick' );
    1176                         jQuery('body.update-php div.wrap p:last').hide();
    1177                         jQuery('body.update-php div.wrap p:last').after( '<p><a class="button" target="_parent" href="<?php echo $form_action; ?>"><?php _e( 'Finish', 'buddypress' ) ?></a></p>' );
    1178                 }
    1179         </script>
    1180 
    1181 <?php
    1182 }
    1183 add_action( 'admin_footer', 'bp_core_wizard_thickbox' );
    1184 
    1185 function bp_core_update_add_admin_menu_styles() {
    1186         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    1187                 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( '/buddypress' ) . '/bp-core/css/admin.dev.css' ), array(), '20110723' );
    1188                 wp_enqueue_script( 'bp-update-js', apply_filters( 'bp_core_update_js', plugins_url( '/buddypress' ) . '/bp-core/js/update.dev.js' ), array( 'jquery' ), '20110723' );
    1189         } else {
    1190                 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( '/buddypress' ) . '/bp-core/css/admin.css' ), array(), '20110723' );
    1191                 wp_enqueue_script( 'bp-update-js', apply_filters( 'bp_core_update_js', plugins_url( '/buddypress' ) . '/bp-core/js/update.js' ), array( 'jquery' ), '20110723' );
    1192         }
    1193 
    1194         wp_enqueue_script( 'thickbox' );
    1195         wp_enqueue_style( 'thickbox' );
    1196 }
    1197 add_action( 'admin_head', 'bp_core_update_add_admin_menu_styles' );
    1198 
    1199 /**
    1200  * Fetches BP pages from the meta table
    1201  *
    1202  * @package BuddyPress Core
    1203  * @since 1.5
    1204  *
    1205  * @return array $page_ids
    1206  */
    1207 function bp_core_update_get_page_meta() {
    1208         $page_ids = bp_get_option( 'bp-pages' );
    1209         if ( empty( $page_ids ) )
    1210                 $page_ids = array();
    1211 
    1212         return apply_filters( 'bp_core_update_get_page_meta', $page_ids );
    1213 }
    1214 
    1215 function bp_core_update_do_network_admin() {
    1216         $do_network_admin = false;
    1217 
    1218         if ( is_multisite() && ( !defined( 'BP_ENABLE_MULTIBLOG' ) || !BP_ENABLE_MULTIBLOG ) )
    1219                 $do_network_admin = true;
    1220 
    1221         return apply_filters( 'bp_core_do_network_admin', $do_network_admin );
    1222 }
    1223 
    1224 function bp_core_update_admin_hook() {
    1225         $hook = bp_core_update_do_network_admin() ? 'network_admin_menu' : 'admin_menu';
    1226 
    1227         return apply_filters( 'bp_core_admin_hook', $hook );
    1228 }
    1229 
    1230 /**
    1231  * Adds the "BuddyPress" admin submenu item to the Site Admin tab.
    1232  *
    1233  * @package BuddyPress Core
    1234  * @global object $bp Global BuddyPress settings object
    1235  * @global $wpdb WordPress DB access object.
    1236  * @uses add_submenu_page() WP function to add a submenu item
    1237  */
    1238 function bp_core_update_add_admin_menu() {
    1239         global $bp_wizard;
    1240 
    1241         // Only load this version of the menu if this is an upgrade or a new installation
    1242         if ( empty( $bp_wizard->setup_type ) )
    1243                 return false;
    1244 
    1245         if ( !current_user_can( 'manage_options' ) )
    1246                 return false;
    1247 
    1248         if ( 'install' == $bp_wizard->setup_type )
    1249                 $status = __( 'BuddyPress Setup', 'buddypress' );
    1250         else
    1251                 $status = __( 'Update BuddyPress',  'buddypress' );
    1252 
    1253         // Add the administration tab under the "Site Admin" tab for site administrators
    1254         if ( ! is_multisite() || bp_is_multiblog_mode() )
    1255                 $hook = add_dashboard_page( $status, $status, 'manage_options', 'bp-wizard', array( $bp_wizard, 'html' ) );
    1256         else
    1257                 $hook = add_submenu_page( 'update-core.php', $status, $status, 'manage_options', 'bp-wizard', array( $bp_wizard, 'html' ) );
    1258 
    1259         // Add a hook for css/js
    1260         add_action( "admin_print_styles-$hook", 'bp_core_update_add_admin_menu_styles' );
    1261 }
    1262 add_action( bp_core_update_admin_hook(),  'bp_core_update_add_admin_menu', 9 );
    1263 
    1264 /**
    1265  * Adds an admin nag about running the BP upgrade/install wizard
    1266  *
    1267  * @package BuddyPress Core
    1268  * @since 1.5
    1269  * @global $pagenow The current admin page
    1270  */
    1271 function bp_core_update_nag() {
    1272         global $bp_wizard, $pagenow;
    1273 
    1274         // Bail if no wizard
    1275         if ( empty( $bp_wizard->setup_type ) )
    1276                 return;
    1277 
    1278         // Bail if user cannot manage options
    1279         if ( ! current_user_can( 'manage_options' ) )
    1280                 return;
    1281 
    1282         // Are we looking at a network?
    1283         if ( bp_core_update_do_network_admin() ) {
    1284                
    1285                 // Bail if looking at wizard page
    1286                 if ( ( 'admin.php' == $pagenow ) && ( !empty( $_GET['page'] ) && ( 'bp-wizard' == $_GET['page'] ) ) ) {
    1287                         return;
    1288                 }
    1289 
    1290                 // Set the url for the nag
    1291                 $url = network_admin_url( 'admin.php?page=bp-wizard' );
    1292                
    1293         // Single site
    1294         } else {
    1295 
    1296                 // Bail if looking at wizard page
    1297                 if ( ( 'index.php' == $pagenow ) && ( !empty( $_GET['page'] ) && ( 'bp-wizard' == $_GET['page'] ) ) ) {
    1298                         return;
    1299                 }
    1300 
    1301                 // Set the url for the nag
    1302                 $url = admin_url( 'index.php?page=bp-wizard' );
    1303         }
    1304 
    1305         // What does the nag say?
    1306         switch( $bp_wizard->setup_type ) {
    1307 
    1308                 // Update text
    1309                 case 'update' :
    1310                         $msg = sprintf( __( 'BuddyPress has been updated! Please run the <a href="%s">update wizard</a>.', 'buddypress' ), $url );
    1311                         break;
    1312 
    1313                 // First install text
    1314                 case 'install' : default :
    1315                         $msg = sprintf( __( 'BuddyPress was successfully activated! Please run the <a href="%s">installation wizard</a>.', 'buddypress' ), $url );
    1316                         break;
    1317         } ?>
    1318 
    1319         <div class="update-nag"><?php echo $msg; ?></div>
    1320 
    1321 <?php
    1322 }
    1323 add_action( 'admin_notices',         'bp_core_update_nag', 5 );
    1324 add_action( 'network_admin_notices', 'bp_core_update_nag', 5 );
    13251053
    13261054?>
  • trunk/bp-core/admin/css/wizard.dev.css

    r5739 r5749  
    1 
    2 /* Icon 32
    3 ------------------------------------------------------------------------------*/
    4 
    5 div#icon-buddypress {
    6         background: url( ../images/icons32.png ) no-repeat -370px -6px;
    7 }
    8 
    9 div#icon-buddypress-activity {
    10         background: url( ../images/icons32.png ) no-repeat -10px -6px;
    11 }
    12 
    13 /* Menu Icons
    14 ------------------------------------------------------------------------------*/
    15 
    16 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a img {
    17         display: none;
    18 }
    19 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a {
    20         background-image: url( '../images/menu.png' ) !important;
    21         background-position: -178pxpx -34px;
    22 }
    23 ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image a,
    24 ul#adminmenu li.toplevel_page_bp-wizard.wp-has-current-submenu .wp-menu-image a {
    25         background-position: -178px -2px;
    26 }
    27 
    28 /* Backpat Icon */
    29 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image a img,
    30 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img {
    31         display: none;
    32 }
    33 
    34 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image a,
    35 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a {
    36         background-image: url( '../images/menu.png' ) !important;
    37         background-position: -178px -34px;
    38 }
    39 
    40 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image a,
    41 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a,
    42 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image a,
    43 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a {
    44         background-position: -178px -2px;
    45 }
    46 
    47 /* Activity Icon */
    48 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a img {
    49         display: none;
    50 }
    51 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a {
    52         background-image: url( '../images/menu.png' ) !important;
    53         background-position: 0px -34px;
    54 }
    55 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image a,
    56 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image a,
    57 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image a {
    58         background-position: 0 -2px;
    59 }
    601
    612/* General Admin Styling
    623------------------------------------------------------------------------------*/
    634
    64 div#bp-admin {
     5div#bp-wizard {
    656        color: #555;
    667        min-width: 680px;
    678}
    68 div#bp-admin p {
     9div#bp-wizard p {
    6910        line-height: 170%;
    7011}
    7112
    72 form#bp-admin-form {
     13form#bp-wizard-form {
    7314        margin: 0 10px;
    7415}
    7516
    76 div#bp-admin-nav {
     17div#bp-wizard-nav {
    7718        background: #e0e0e0;
    7819        margin: 15px -10px 10px;
     
    8324        border-radius: 2px;
    8425}
    85 div#bp-admin-nav div.submit {
     26div#bp-wizard-nav div.submit {
    8627        position: relative;
    8728        float: right;
    8829        margin-top: -36px !important;
    8930}
    90 div#bp-admin-nav div.submit input {
     31div#bp-wizard-nav div.submit input {
    9132        padding: 6px 10px;
    9233}
    93         div#bp-admin-nav ol {
     34        div#bp-wizard-nav ol {
    9435                list-style-type: decimal;
    9536                margin: 0;
    9637                padding: 0;
    9738        }
    98                 div#bp-admin-nav ol li {
     39                div#bp-wizard-nav ol li {
    9940                        float: left;
    10041                        margin: 0 10px 0 0;
    10142                        color: #666;
    10243                }
    103                         div#bp-admin-nav ol li {
     44                        div#bp-wizard-nav ol li {
    10445                                padding: 8px 12px;
    10546                                display: block;
     
    10950                                text-decoration: none;
    11051                        }
    111                                 div#bp-admin-nav ol li.current {
     52                                div#bp-wizard-nav ol li.current {
    11253                                        background: #fff;
    11354                                        color: #555;
    11455                                }
    11556
    116         div#bp-admin-nav ol li span.complete {
     57        div#bp-wizard-nav ol li span.complete {
    11758                background: url( ../images/completed.gif ) center left no-repeat;
    11859                padding: 6px;
     
    15596        }
    15697
    157 div#bp-admin div.prev-next, div#bp-admin div.prev-next p,
    158 div#bp-admin div.submit, div#bp-admin div.submit p {
     98div#bp-wizard div.prev-next, div#bp-wizard div.prev-next p,
     99div#bp-wizard div.submit, div#bp-wizard div.submit p {
    159100        margin: 0;
    160101        padding: 0;
    161102}
    162 div#bp-admin div.submit { margin-top: 30px; }
    163 div#bp-admin div.prev-next { text-align: right; margin-top: 0; }
     103div#bp-wizard div.submit {
     104        margin-top: 30px;
     105}
     106div#bp-wizard div.prev-next {
     107        text-align: right;
     108        margin-top: 0;
     109}
    164110
    165 div#bp-admin div.prev-next {
     111div#bp-wizard div.prev-next {
    166112        margin: 0 -20px;
    167113        padding: 0 20px 10px;
    168114}
    169115
    170 div#bp-admin table td {
     116div#bp-wizard table td {
    171117        font-family: helvetica, arial, tahoma, sans-serif;
    172118        vertical-align: top;
    173119}
    174120
    175 div#bp-admin table.form-table th {
     121div#bp-wizard table.form-table th {
    176122        border-right: 1px solid #eee;
    177123        padding: 15px 25px 15px 0;
     
    179125        vertical-align: top;
    180126}
    181         div#bp-admin table.form-table tr {
     127        div#bp-wizard table.form-table tr {
    182128                border-bottom: 1px dotted #f0f0f0;
    183129        }
    184         div#bp-admin table.form-table td { padding-left: 25px; font-size: 12px; }
     130        div#bp-wizard table.form-table td {
     131                padding-left: 25px;
     132                font-size: 12px;
     133        }
    185134
    186         div#bp-admin table.form-table th h5 {
     135        div#bp-wizard table.form-table th h5 {
    187136                font-size: 14px;
    188137                margin: 0;
     
    190139        }
    191140
    192         div#bp-admin table.form-table th img {
     141        div#bp-wizard table.form-table th img {
    193142                margin-top: 5px;
    194143        }
    195144
    196         div#bp-admin table.form-table th p { margin: 3px 0 0 0; }
     145        div#bp-wizard table.form-table th p {
     146                margin: 3px 0 0 0;
     147        }
    197148
    198 div#bp-admin code, div#bp-admin kbd {
     149div#bp-wizard code, div#bp-wizard kbd {
    199150        font-size: 12px;
    200151        background: #f0f0f0;
    201152}
    202153
    203 div#bp-admin div#message code, div#bp-admin div#message kbd {
     154div#bp-wizard div#message code, div#bp-wizard div#message kbd {
    204155        background: #ffe293;
    205156}
     
    209160}
    210161
    211 a.installed, a.installed:hover, a.installed:active {
     162a.installed,
     163a.installed:hover,
     164a.installed:active {
    212165        padding-left: 15px;
    213166        color: #888;
     
    217170
    218171a.installed span {
    219         background: url( ../images/installed.gif) left center no-repeat;
     172        background: url( ../images/installed.gif ) left center no-repeat;
    220173        padding: 6px 10px 7px 6px;
    221174        margin-left: -5px;
  • trunk/bp-core/bp-core-admin.php

    r5661 r5749  
    4545        public $styles_url = '';
    4646
     47        /**
     48         * @var string URL to the BuddyPress admin CSS directory
     49         */
     50        public $css_url = '';
     51
     52        /**
     53         * @var string URL to the BuddyPress admin JS directory
     54         */
     55        public $js_url = '';
     56
    4757        /** Recounts **************************************************************/
    4858
     
    5969        public $content_depth = 0;
    6070
    61         /** Functions *************************************************************/
     71        /** Methods ***************************************************************/
    6272
    6373        /**
     
    7787
    7888        /**
     89         * Admin globals
     90         *
     91         * @since BuddyPress (1.6)
     92         * @access private
     93         */
     94        private function setup_globals() {
     95                global $bp;
     96
     97                // Admin url
     98                $this->admin_dir  = trailingslashit( $bp->plugin_dir . 'bp-core/admin' );
     99
     100                // Admin url
     101                $this->admin_url  = trailingslashit( $bp->plugin_url . 'bp-core/admin' );
     102
     103                // Admin images URL
     104                $this->images_url = trailingslashit( $this->admin_url . 'images' );
     105
     106                // Admin css URL
     107                $this->css_url    = trailingslashit( $this->admin_url . 'css'    );
     108
     109                // Admin css URL
     110                $this->js_url     = trailingslashit( $this->admin_url . 'js'     );
     111
     112                // Admin images URL
     113                $this->styles_url = trailingslashit( $this->admin_url . 'styles' );
     114        }
     115
     116        /**
     117         * Include required files
     118         *
     119         * @since BuddyPress (1.6)
     120         * @access private
     121         */
     122        private function includes() {
     123
     124                // If in maintenance mode, only include updater and schema
     125                if ( bp_get_maintenance_mode() ) {
     126                        require( $this->admin_dir . 'bp-core-schema.php' );
     127                        require( $this->admin_dir . 'bp-core-update.php' );
     128
     129                // No update needed so proceed with loading everything
     130                } else {
     131                        require( $this->admin_dir . 'bp-core-settings.php'   );
     132                        require( $this->admin_dir . 'bp-core-functions.php'  );
     133                        require( $this->admin_dir . 'bp-core-components.php' );
     134                        require( $this->admin_dir . 'bp-core-slugs.php'      );
     135                }
     136        }
     137
     138        /**
    79139         * Setup the admin hooks, actions and filters
    80140         *
     
    87147        private function setup_actions() {
    88148
     149                // Start the wizard if in maintenance mode
     150                if ( bp_get_maintenance_mode() ) {
     151                        add_action( bp_core_admin_hook(), array( $this, 'start_wizard' ), 2 );
     152                }
     153
    89154                /** General Actions ***************************************************/
    90155
    91156                // Attach the BuddyPress admin_init action to the WordPress admin_init action.
    92                 add_action( 'admin_init',         array( $this, 'admin_init'                 ) );
    93 
    94                 // Add some general styling to the admin area
    95                 add_action( 'admin_head',         array( $this, 'admin_head'                 ) );
     157                add_action( 'admin_init',            array( $this, 'admin_init'  ) );
     158
     159                // Add some page specific output to the <head>
     160                add_action( 'admin_head',            array( $this, 'admin_head'  ) );
    96161
    97162                // Add menu item to settings menu
    98                 add_action( bp_core_admin_hook(), array( $this, 'admin_menus'                ), 5 );
     163                add_action( bp_core_admin_hook(),    array( $this, 'admin_menus' ), 5 );
    99164
    100165                // Add notice if not using a BuddyPress theme
    101                 add_action( 'admin_notices',      array( $this, 'activation_notice'          ) );
    102 
    103                 // Add importers
    104                 //add_action( 'bp_admin_init',      array( $this, 'register_importers'         ) );
    105 
    106                 // Add green admin style
    107                 //add_action( 'bp_admin_init',      array( $this, 'register_admin_style'       ) );
    108 
    109                 // Add settings
    110                 add_action( 'bp_admin_init',      array( $this, 'register_admin_settings'    ) );
     166                add_action( 'admin_notices',         array( $this, 'admin_notices' ) );
     167
     168                // Enqueue all admin JS and CSS
     169                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts'   ) );
    111170
    112171                // Forums 'Right now' Dashboard widget
    113172                //add_action( 'wp_dashboard_setup', array( $this, 'dashboard_widget_right_now' ) );
    114173
     174                /** BuddyPress Actions ************************************************/
     175
     176                // Add importers
     177                //add_action( 'bp_admin_init',      array( $this, 'register_importers'      ) );
     178
     179                // Add red admin style
     180                //add_action( 'bp_admin_init',      array( $this, 'register_admin_style'    ) );
     181
     182                // Add settings
     183                add_action( 'bp_admin_init',      array( $this, 'register_admin_settings' ) );
     184
    115185                /** Filters ***********************************************************/
    116186
     
    122192        }
    123193
    124         /**
    125          * Include required files
    126          *
    127          * @since BuddyPress (1.6)
    128          * @access private
    129          */
    130         private function includes() {
    131 
    132                 // Include the files
    133                 require_once( $this->admin_dir . 'bp-core-settings.php'   );
    134                 require_once( $this->admin_dir . 'bp-core-functions.php'  );
    135                 require_once( $this->admin_dir . 'bp-core-components.php' );
    136                 require_once( $this->admin_dir . 'bp-core-slugs.php'      );
    137                 //require( $this->admin_dir . 'bp-metaboxes.php'       );
    138         }
    139 
    140         /**
    141          * Admin globals
    142          *
    143          * @since BuddyPress (1.6)
    144          * @access private
    145          */
    146         private function setup_globals() {
    147                 global $bp;
    148 
    149                 // Admin url
    150                 $this->admin_dir  = trailingslashit( $bp->plugin_dir . 'bp-core/admin' );
    151 
    152                 // Admin url
    153                 $this->admin_url  = trailingslashit( $bp->plugin_url . 'bp-core/bp-admin' );
    154 
    155                 // Admin images URL
    156                 $this->images_url = trailingslashit( $this->admin_url . 'images' );
    157 
    158                 // Admin images URL
    159                 $this->styles_url = trailingslashit( $this->admin_url . 'styles' );
     194        public function start_wizard() {
     195                $this->wizard = new BP_Core_Setup_Wizard;
    160196        }
    161197
     
    171207        public function admin_menus() {
    172208
    173                 if ( ! bp_current_user_can( 'bp_moderate' ) )
    174                         return;
    175 
    176                 // Don't add this version of the admin menu if a BP upgrade is in progress.
    177                 // @see bp_core_update_add_admin_menu().
    178                 if ( defined( 'BP_IS_UPGRADE' ) && BP_IS_UPGRADE )
    179                         return;
    180 
    181                 $hooks = array();
    182                 $page  = bp_core_do_network_admin()  ? 'settings.php' : 'options-general.php';
    183 
    184                 // Changed in BP 1.6 . See bp_core_admin_backpat_menu()
    185                 $hooks[] = add_menu_page(
    186                         __( 'BuddyPress', 'buddypress' ),
    187                         __( 'BuddyPress', 'buddypress' ),
    188                         'manage_options',
    189                         'bp-general-settings',
    190                         'bp_core_admin_backpat_menu',
    191                         ''
    192                 );
    193 
    194                 $hooks[] = add_submenu_page(
    195                         'bp-general-settings',
    196                         __( 'BuddyPress Help', 'buddypress' ),
    197                         __( 'Help', 'buddypress' ),
    198                         'manage_options',
    199                         'bp-general-settings',
    200                         'bp_core_admin_backpat_page'
    201                 );
    202 
    203                 // Add the option pages
    204                 $hooks[] = add_submenu_page(
    205                         $page,
    206                         __( 'BuddyPress Components', 'buddypress' ),
    207                         __( 'BuddyPress', 'buddypress' ),
    208                         'manage_options',
    209                         'bp-components',
    210                         'bp_core_admin_components_settings'
    211                 );
    212 
    213                 $hooks[] = add_submenu_page(
    214                         $page,
    215                         __( 'BuddyPress Pages', 'buddypress' ),
    216                         __( 'BuddyPress Pages', 'buddypress' ),
    217                         'manage_options',
    218                         'bp-page-settings',
    219                         'bp_core_admin_slugs_settings'
    220                 );
    221 
    222                 $hooks[] = add_submenu_page(
    223                         $page,
    224                         __( 'BuddyPress Settings', 'buddypress' ),
    225                         __( 'BuddyPress Settings', 'buddypress' ),
    226                         'manage_options',
    227                         'bp-settings',
    228                         'bp_core_admin_settings'
    229                 );
    230 
    231                 foreach( $hooks as $hook ) {
    232 
    233                         // Add a hook for common BP admin CSS/JS scripts
    234                         add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' );
     209                // In maintenance mode
     210                if ( bp_get_maintenance_mode() ) {
     211
     212                        if ( !current_user_can( 'manage_options' ) )
     213                                return;
     214
     215                        if ( bp_get_maintenance_mode() == 'install' )
     216                                $status = __( 'BuddyPress Setup', 'buddypress' );
     217                        else
     218                                $status = __( 'Update BuddyPress',  'buddypress' );
     219
     220                        if ( bp_get_wizard() ) {
     221                                if ( ! is_multisite() || bp_is_multiblog_mode() ) {
     222                                        $hook = add_dashboard_page( $status, $status, 'manage_options', 'bp-wizard', array( bp_get_wizard(), 'html' ) );
     223                                } else {
     224                                        $hook = add_submenu_page( 'update-core.php', $status, $status, 'manage_options', 'bp-wizard', array( bp_get_wizard(), 'html' ) );
     225                                }
     226                        }
     227
     228                // Not in maintenance mode
     229                } else {
     230       
     231                        // Bail if user cannot moderate
     232                        if ( ! bp_current_user_can( 'manage_options' ) )
     233                                return;
     234
     235                        $hooks = array();
     236                        $page  = bp_core_do_network_admin()  ? 'settings.php' : 'options-general.php';
     237
     238                        // Changed in BP 1.6 . See bp_core_admin_backpat_menu()
     239                        $hooks[] = add_menu_page(
     240                                __( 'BuddyPress', 'buddypress' ),
     241                                __( 'BuddyPress', 'buddypress' ),
     242                                'manage_options',
     243                                'bp-general-settings',
     244                                'bp_core_admin_backpat_menu',
     245                                ''
     246                        );
     247
     248                        $hooks[] = add_submenu_page(
     249                                'bp-general-settings',
     250                                __( 'BuddyPress Help', 'buddypress' ),
     251                                __( 'Help', 'buddypress' ),
     252                                'manage_options',
     253                                'bp-general-settings',
     254                                'bp_core_admin_backpat_page'
     255                        );
     256
     257                        // Add the option pages
     258                        $hooks[] = add_submenu_page(
     259                                $page,
     260                                __( 'BuddyPress Components', 'buddypress' ),
     261                                __( 'BuddyPress', 'buddypress' ),
     262                                'manage_options',
     263                                'bp-components',
     264                                'bp_core_admin_components_settings'
     265                        );
     266
     267                        $hooks[] = add_submenu_page(
     268                                $page,
     269                                __( 'BuddyPress Pages', 'buddypress' ),
     270                                __( 'BuddyPress Pages', 'buddypress' ),
     271                                'manage_options',
     272                                'bp-page-settings',
     273                                'bp_core_admin_slugs_settings'
     274                        );
     275
     276                        $hooks[] = add_submenu_page(
     277                                $page,
     278                                __( 'BuddyPress Settings', 'buddypress' ),
     279                                __( 'BuddyPress Settings', 'buddypress' ),
     280                                'manage_options',
     281                                'bp-settings',
     282                                'bp_core_admin_settings'
     283                        );
    235284
    236285                        // Fudge the highlighted subnav item when on a BuddyPress admin page
    237                         add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
     286                        foreach( $hooks as $hook ) {
     287                                add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
     288                        }
    238289                }
    239290        }
     
    398449
    399450        /**
    400          * Admin area activation notice
    401          *
    402          * Shows a nag message in admin area about the theme not supporting BuddyPress
    403          *
    404          * @since BuddyPress (1.6)
    405          *
    406          * @uses current_user_can() To check notice should be displayed.
    407          */
    408         public function activation_notice() {
    409                 // @todo - something fun
    410         }
    411 
    412         /**
    413451         * Add Settings link to plugins area
    414452         *
     
    457495         *
    458496         * @since BuddyPress (1.6)
    459          *
    460          * @uses bp_get_forum_post_type() To get the forum post type
    461          * @uses bp_get_topic_post_type() To get the topic post type
    462          * @uses bp_get_reply_post_type() To get the reply post type
    463          * @uses sanitize_html_class() To sanitize the classes
    464          * @uses do_action() Calls 'bp_admin_head'
    465          */
    466         public function admin_head() {
    467 
    468                 // Icons for top level admin menus
    469                 $menu_icon_url = $this->images_url . 'menu.png';
    470                 $icon32_url    = $this->images_url . 'icons32.png'; ?>
    471 
    472                 <style type="text/css" media="screen">
    473                 /*<![CDATA[*/
    474 
    475                         #bp-dashboard-right-now p.sub,
    476                         #bp-dashboard-right-now .table,
    477                         #bp-dashboard-right-now .versions {
    478                                 margin: -12px;
    479                         }
    480 
    481                         #bp-dashboard-right-now .inside {
    482                                 font-size: 12px;
    483                                 padding-top: 20px;
    484                                 margin-bottom: 0;
    485                         }
    486 
    487                         #bp-dashboard-right-now p.sub {
    488                                 padding: 5px 0 15px;
    489                                 color: #8f8f8f;
    490                                 font-size: 14px;
    491                                 position: absolute;
    492                                 top: -17px;
    493 
    494                                 <?php if ( is_rtl() ) : ?>
    495 
    496                                         right: 15px;
    497 
    498                                 <?php else : ?>
    499 
    500                                         left: 15px;
    501 
    502                                 <?php endif; ?>
    503 
    504                         }
    505 
    506                         #bp-dashboard-right-now .table {
    507                                 margin: 0;
    508                                 padding: 0;
    509                                 position: relative;
    510                         }
    511 
    512                         #bp-dashboard-right-now .table_content {
    513 
    514                                 <?php if ( is_rtl() ) : ?>
    515 
    516                                         float: right;
    517 
    518                                 <?php else : ?>
    519 
    520                                         float: left;
    521 
    522                                 <?php endif; ?>
    523 
    524                                 border-top: #ececec 1px solid;
    525                                 width: 45%;
    526                         }
    527 
    528                         #bp-dashboard-right-now .table_discussion {
    529 
    530                                 <?php if ( is_rtl() ) : ?>
    531 
    532                                         float: left;
    533 
    534                                 <?php else : ?>
    535 
    536                                         float: right;
    537 
    538                                 <?php endif; ?>
    539 
    540                                 border-top: #ececec 1px solid;
    541                                 width: 45%;
    542                         }
    543 
    544                         #bp-dashboard-right-now table td {
    545                                 padding: 3px 0;
    546                                 white-space: nowrap;
    547                         }
    548 
    549                         #bp-dashboard-right-now table tr.first td {
    550                                 border-top: none;
    551                         }
    552 
    553                         #bp-dashboard-right-now td.b {
    554 
    555                                 <?php if ( is_rtl() ) : ?>
    556 
    557                                         padding-left: 6px;
    558 
    559                                 <?php else : ?>
    560 
    561                                         padding-right: 6px;
    562 
    563                                 <?php endif; ?>
    564 
    565                                 text-align: right;
    566                                 font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
    567                                 font-size: 14px;
    568                                 width: 1%;
    569                         }
    570 
    571                         #bp-dashboard-right-now td.b a {
    572                                 font-size: 18px;
    573                         }
    574 
    575                         #bp-dashboard-right-now td.b a:hover {
    576                                 color: #d54e21;
    577                         }
    578 
    579                         #bp-dashboard-right-now .t {
    580                                 font-size: 12px;
    581 
    582                                 <?php if ( is_rtl() ) : ?>
    583 
    584                                         padding-left: 12px;
    585 
    586                                 <?php else : ?>
    587 
    588                                         padding-right: 12px;
    589 
    590                                 <?php endif; ?>
    591 
    592                                 padding-top: 6px;
    593                                 color: #777;
    594                         }
    595 
    596                         #bp-dashboard-right-now .t a {
    597                                 white-space: nowrap;
    598                         }
    599 
    600                         #bp-dashboard-right-now .spam {
    601                                 color: red;
    602                         }
    603 
    604                         #bp-dashboard-right-now .waiting {
    605                                 color: #e66f00;
    606                         }
    607 
    608                         #bp-dashboard-right-now .approved {
    609                                 color: green;
    610                         }
    611 
    612                         #bp-dashboard-right-now .versions {
    613                                 padding: 6px 10px 12px;
    614                                 clear: both;
    615                         }
    616 
    617                         #bp-dashboard-right-now .versions .b {
    618                                 font-weight: bold;
    619                         }
    620 
    621                         #bp-dashboard-right-now a.button {
    622 
    623                                 <?php if ( is_rtl() ) : ?>
    624 
    625                                         float: left;
    626                                         clear: left;
    627 
    628                                 <?php else : ?>
    629 
    630                                         float: right;
    631                                         clear: right;
    632 
    633                                 <?php endif; ?>
    634 
    635                                 position: relative;
    636                                 top: -5px;
    637                         }
    638 
    639                 /*]]>*/
    640                 </style>
    641 
    642                 <?php
    643 
    644                 // Add extra actions to BuddyPress admin header area
     497         */
     498        public function admin_head() { }
     499
     500        /**
     501         * Add some general styling to the admin area
     502         *
     503         * @since BuddyPress (1.6)
     504         */
     505        public function enqueue_scripts() {
     506
     507                $maybe_dev = '';
     508                if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
     509                        $maybe_dev = '.dev';
     510
     511                $file = $this->css_url . "common{$maybe_dev}.css";
     512                $file = apply_filters( 'bp_core_admin_common_css', $file );
     513                wp_enqueue_style( 'bp-admin-common-css', $file, array(), bp_get_version() );
     514
     515                // Extra bits for the installation wizard
     516                if ( bp_get_maintenance_mode() ) {
     517
     518                        // Styling
     519                        $file = $this->css_url . "wizard{$maybe_dev}.css";
     520                        $file = apply_filters( 'bp_core_admin_wizard_css', $file );
     521                        wp_enqueue_style( 'bp-admin-wizard-css', $file, array(), bp_get_version() );
     522
     523                        // JS
     524                        $file = $this->js_url . "wizard{$maybe_dev}.js";
     525                        $file = apply_filters( 'bp_core_admin_wizard_js', $file );
     526                        wp_enqueue_script( 'bp-admin-wizard-js', $file, array(), bp_get_version() );
     527
     528                        // We'll need the thickbox too
     529                        wp_enqueue_script( 'thickbox' );
     530                        wp_enqueue_style( 'thickbox' );
     531                }
     532
    645533                do_action( 'bp_admin_head' );
    646534        }
     
    673561                // Load the admin CSS styling
    674562                //wp_admin_css_color( 'buddypress', __( 'Green', 'buddypress' ), $css_file, array( '#222222', '#006600', '#deece1', '#6eb469' ) );
     563        }
     564
     565        /**
     566         * Add any admin notices we might need, mostly for update or new installs
     567         *
     568         * @since BuddyPress (1.6)
     569         *
     570         * @global string $pagenow
     571         * @return If no notice is needed
     572         */
     573        public function admin_notices() {
     574                global $pagenow;
     575
     576                // Bail if not in maintenance mode
     577                if ( ! bp_get_maintenance_mode() )
     578                        return;
     579
     580                // Bail if user cannot manage options
     581                if ( ! current_user_can( 'manage_options' ) )
     582                        return;
     583
     584                // Are we looking at a network?
     585                if ( bp_core_do_network_admin() ) {
     586
     587                        // Bail if looking at wizard page
     588                        if ( ( 'admin.php' == $pagenow ) && ( !empty( $_GET['page'] ) && ( 'bp-wizard' == $_GET['page'] ) ) ) {
     589                                return;
     590                        }
     591
     592                        // Set the url for the nag
     593                        $url = network_admin_url( 'admin.php?page=bp-wizard' );
     594
     595                // Single site
     596                } else {
     597
     598                        // Bail if looking at wizard page
     599                        if ( ( 'index.php' == $pagenow ) && ( !empty( $_GET['page'] ) && ( 'bp-wizard' == $_GET['page'] ) ) ) {
     600                                return;
     601                        }
     602
     603                        // Set the url for the nag
     604                        $url = admin_url( 'index.php?page=bp-wizard' );
     605                }
     606
     607                // What does the nag say?
     608                switch ( bp_get_maintenance_mode() ) {
     609
     610                        // Update text
     611                        case 'update' :
     612                                $msg = sprintf( __( 'BuddyPress has been updated! Please run the <a href="%s">update wizard</a>.', 'buddypress' ), $url );
     613                                break;
     614
     615                        // First install text
     616                        case 'install' : default :
     617                                $msg = sprintf( __( 'BuddyPress was successfully activated! Please run the <a href="%s">installation wizard</a>.', 'buddypress' ), $url );
     618                                break;
     619                } ?>
     620
     621                <div class="update-nag"><?php echo $msg; ?></div>
     622
     623                <?php
    675624        }
    676625}
  • trunk/bp-forums/bp-forums-admin.php

    r5729 r5749  
    44
    55function bp_forums_add_admin_menu() {
    6         global $bp;
    76
    87        if ( ! bp_current_user_can( 'bp_moderate' ) )
     
    1312        $hook = add_submenu_page( $page, __( 'BuddyPress Forums', 'buddypress' ), __( 'BuddyPress Forums', 'buddypress' ), 'manage_options', 'bb-forums-setup', 'bp_forums_bbpress_admin' );
    1413
    15         // Add a hook for common BP admin CSS/JS scripts
    16         add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' );
    17 
    1814        // Fudge the highlighted subnav item when on a BuddyPress admin page
    1915        add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
     
    2218
    2319function bp_forums_bbpress_admin() {
    24         global $bp;
    2520
    2621        $action = bp_get_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' ); ?>
     
    209204
    210205function bp_forums_configure_existing_install() {
    211         global $wpdb, $bbdb;
    212206
    213207        check_admin_referer( 'bp_forums_existing_install_init' );
     
    232226
    233227function bp_forums_bbpress_install() {
    234         global $wpdb, $bbdb, $bp;
     228        global $wpdb, $bp;
    235229
    236230        check_admin_referer( 'bp_forums_new_install_init' );
  • trunk/bp-loader.php

    r5727 r5749  
    315315         * @uses plugin_dir_url()
    316316         */
    317         public function constants() {
     317        private function constants() {
    318318
    319319                // Define the BuddyPress version
     
    475475                        // The installation process requires a few BuddyPress core libraries
    476476                        if ( !empty( $this->maintenance_mode ) ) {
    477                                 require( $this->plugin_dir . 'bp-core/bp-core-functions.php'    );
    478                                 require( $this->plugin_dir . 'bp-core/bp-core-update.php'       );
    479                                 require( $this->plugin_dir . 'bp-core/bp-core-caps.php'         );
    480                                 require( $this->plugin_dir . 'bp-core/bp-core-options.php'      );
    481                                 require( $this->plugin_dir . 'bp-core/admin/bp-core-update.php' );
     477                                require( $this->plugin_dir . 'bp-core/bp-core-admin.php'     );
     478                                require( $this->plugin_dir . 'bp-core/bp-core-functions.php' );
     479                                require( $this->plugin_dir . 'bp-core/bp-core-template.php'  );
     480                                require( $this->plugin_dir . 'bp-core/bp-core-update.php'    );
     481                                require( $this->plugin_dir . 'bp-core/bp-core-caps.php'      );
     482                                require( $this->plugin_dir . 'bp-core/bp-core-options.php'   );
     483
     484                                // Load up BuddyPress's admin
     485                                add_action( 'plugins_loaded', 'bp_admin' );
    482486                        }
    483487                }
  • trunk/bp-xprofile/bp-xprofile-admin.php

    r5699 r5749  
    2828                return false;
    2929
    30         $hook = add_users_page( __( 'Profile Fields', 'buddypress' ), __( 'Profile Fields', 'buddypress' ), 'manage_options', 'bp-profile-setup', 'xprofile_admin' );
    31 
    32         add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' );
     30        add_users_page( __( 'Profile Fields', 'buddypress' ), __( 'Profile Fields', 'buddypress' ), 'manage_options', 'bp-profile-setup', 'xprofile_admin' );
    3331}
    3432add_action( bp_core_admin_hook(), 'xprofile_add_admin_menu' );
  • trunk/bp-xprofile/bp-xprofile-cssjs.php

    r5699 r5749  
    2727        }
    2828}
    29 add_action( bp_core_admin_hook(), 'xprofile_add_admin_css' );
     29add_action( 'admin_enqueue_scripts', 'xprofile_add_admin_css' );
    3030
    3131/**
     
    5252        }
    5353}
    54 add_action( bp_core_admin_hook(), 'xprofile_add_admin_js', 1 );
     54add_action( 'admin_enqueue_scripts', 'xprofile_add_admin_js', 1 );
    5555
    5656?>
Note: See TracChangeset for help on using the changeset viewer.