Ticket #2789: 2789.004.patch
File 2789.004.patch, 8.6 KB (added by , 14 years ago) |
---|
-
bp-themes/bp-default/functions.php
88 88 // Add a way for the custom header to be styled in the admin panel that controls custom headers. 89 89 add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' ); 90 90 } 91 92 // When BP is first installed, bp_is_active() won't be defined on the final step of the 93 // wizard. This is a workaround. 94 if ( !function_exists( 'bp_is_active' ) ) 95 return; 91 96 92 97 // Register buttons for the relevant component templates 93 98 // Friends button -
bp-core/admin/bp-core-upgrade.php
1 1 <?php 2 2 3 if ( !defined( 'BP_ROOT_BLOG' ) )4 define( 'BP_ROOT_BLOG', 1 );5 6 require_once( dirname( dirname( __FILE__ ) ) . '/bp-core-wpabstraction.php' );7 8 register_theme_directory( WP_PLUGIN_DIR . '/buddypress/bp-themes' );9 10 // Install site options on activation11 bp_core_activate_site_options( array( 'bp-disable-account-deletion' => 0, 'bp-disable-avatar-uploads' => 0, 'bp-disable-blogforum-comments' => 0, 'bp-disable-forum-directory' => 0, 'bp-disable-profile-sync' => 0 ) );12 13 /**14 * bp_core_activate_site_options()15 *16 * When switching from single to multisite we need to copy blog options to17 * site options.18 *19 * @package BuddyPress Core20 */21 function bp_core_activate_site_options( $keys = array() ) {22 global $bp;23 24 $bp->site_options = bp_core_get_site_options();25 26 if ( !empty( $keys ) && is_array( $keys ) ) {27 $errors = false;28 29 foreach ( $keys as $key => $default ) {30 if ( empty( $bp->site_options[ $key ] ) ) {31 $bp->site_options[ $key ] = get_blog_option( BP_ROOT_BLOG, $key, $default );32 33 if ( !update_site_option( $key, $bp->site_options[ $key ] ) )34 $errors = true;35 }36 }37 38 if ( empty( $errors ) )39 return true;40 }41 42 return false;43 }44 45 3 class BP_Core_Setup_Wizard { 46 4 var $current_step; 47 5 var $steps; … … 1160 1118 } 1161 1119 1162 1120 /** 1163 * bp_core_ add_admin_menu_page()1121 * bp_core_upgrade_add_admin_menu_page() 1164 1122 * 1165 1123 * A better version of add_admin_menu_page() that allows positioning of menus. 1166 1124 * 1167 1125 * @package BuddyPress Core 1168 1126 */ 1169 function bp_core_ add_admin_menu_page( $args = '' ) {1127 function bp_core_upgrade_add_admin_menu_page( $args = '' ) { 1170 1128 global $menu, $admin_page_hooks, $_registered_pages; 1171 1129 1172 1130 $defaults = array( … … 1249 1207 * @global $wpdb WordPress DB access object. 1250 1208 * @uses add_submenu_page() WP function to add a submenu item 1251 1209 */ 1252 function bp_core_ add_admin_menu() {1210 function bp_core_upgrade_add_admin_menu() { 1253 1211 global $bp_wizard; 1254 1212 1213 // Only load this version of the menu if this is an upgrade or a new installation 1214 if ( ( !defined( 'BP_IS_UPGRADE' ) || !BP_IS_UPGRADE ) && ( !defined( 'BP_IS_INSTALL' ) || !BP_IS_INSTALL ) ) 1215 return false; 1216 1255 1217 if ( !current_user_can( 'activate_plugins' ) ) 1256 1218 return false; 1257 1219 … … 1261 1223 $status = __( 'Upgrade', 'buddypress' ); 1262 1224 1263 1225 /* Add the administration tab under the "Site Admin" tab for site administrators */ 1264 bp_core_ add_admin_menu_page( array(1226 bp_core_upgrade_add_admin_menu_page( array( 1265 1227 'menu_title' => __( 'BuddyPress', 'buddypress' ), 1266 1228 'page_title' => __( 'BuddyPress', 'buddypress' ), 1267 1229 'access_level' => 10, 'file' => 'bp-wizard', … … 1272 1234 $hook = add_submenu_page( 'bp-wizard', $status, $status, 'manage_options', 'bp-wizard', array( $bp_wizard, 'html' ) ); 1273 1235 1274 1236 /* Add a hook for css/js */ 1275 add_action( "admin_print_styles-$hook", 'bp_core_ add_admin_menu_styles' );1237 add_action( "admin_print_styles-$hook", 'bp_core_upgrade_add_admin_menu_styles' ); 1276 1238 } 1277 add_action( 'admin_menu', 'bp_core_ add_admin_menu' );1239 add_action( 'admin_menu', 'bp_core_upgrade_add_admin_menu' ); 1278 1240 1279 function bp_core_ add_admin_menu_styles() {1241 function bp_core_upgrade_add_admin_menu_styles() { 1280 1242 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 1281 1243 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( $path = '/buddypress' ) . '/bp-core/css/admin.dev.css' ) ); 1282 1244 else … … 1292 1254 </style> 1293 1255 <?php 1294 1256 } 1257 1258 /** 1259 * Adds an admin nag about running the BP upgrade/install wizard 1260 * 1261 * @package BuddyPress Core 1262 * @since 1.3 1263 * @global $pagenow The current admin page 1264 */ 1265 function bp_core_update_nag() { 1266 if ( !is_super_admin() ) 1267 return; 1268 1269 global $pagenow; 1270 1271 if ( 'admin.php' == $pagenow && ( empty( $_GET['page'] ) || 'bp-wizard' == $_GET['page'] ) ) 1272 return; 1273 1274 if ( defined( 'BP_IS_UPGRADE' ) && BP_IS_UPGRADE ) 1275 $msg = sprintf( __( 'BuddyPress has been updated! Please run the <a href="%s">upgrade wizard</a>.', 'buddypress' ), admin_url( 'admin.php?page=bp-wizard' ) ); 1276 else if ( defined( 'BP_IS_INSTALL' ) && BP_IS_INSTALL ) 1277 $msg = sprintf( __( 'BuddyPress has been installed! Please run the <a href="%s">upgrade wizard</a>.', 'buddypress' ), admin_url( 'admin.php?page=bp-wizard' ) ); 1278 1279 echo "<div class='update-nag'>$msg</div>"; 1280 } 1281 add_action( 'admin_notices', 'bp_core_update_nag', 5 ); 1282 1295 1283 ?> 1284 No newline at end of file -
bp-loader.php
16 16 if ( !defined( 'BP_ROOT_BLOG' ) ) 17 17 define( 'BP_ROOT_BLOG', 1 ); 18 18 19 / ***20 * Check if this is the first time BuddyPress has been loaded, or the first time 21 * since an upgrade. If so, load the install/upgrade routine only. 22 */ 23 if ( get_site_option( 'bp-db-version' ) < constant( 'BP_DB_VERSION' ) ) { 19 // Test to see whether this is a new installation or an upgraded version of BuddyPress 20 $bp_db_version = get_site_option( 'bp-db-version' ); 21 22 if ( !$bp_db_version ) { 23 define( 'BP_IS_INSTALL', true ); 24 24 require_once( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-upgrade.php' ); 25 26 /***27 * If the install or upgrade routine is completed and everything is up to date28 * continue loading BuddyPress as normal.29 */30 25 } else { 31 26 /*** 32 27 * This file will load in each BuddyPress component based on which … … 34 29 */ 35 30 require_once( WP_PLUGIN_DIR . '/buddypress/bp-core.php' ); 36 31 $bp_deactivated = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) ); 37 32 38 33 do_action( 'bp_core_loaded' ); 39 34 40 35 /* Activity Streams */ 41 36 if ( !isset( $bp_deactivated['bp-activity.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-activity.php') ) 42 37 include( BP_PLUGIN_DIR . '/bp-activity.php' ); 43 38 44 39 /* Blog Tracking */ 45 40 if ( !isset( $bp_deactivated['bp-blogs.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-blogs.php') ) 46 41 include( BP_PLUGIN_DIR . '/bp-blogs.php' ); 47 42 48 43 /* bbPress Forum Integration */ 49 44 if ( !isset( $bp_deactivated['bp-forums.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-forums.php') ) 50 45 include( BP_PLUGIN_DIR . '/bp-forums.php' ); 51 46 52 47 /* Friend Connections */ 53 48 if ( !isset( $bp_deactivated['bp-friends.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-friends.php') ) 54 49 include( BP_PLUGIN_DIR . '/bp-friends.php' ); 55 50 56 51 /* Groups Support */ 57 52 if ( !isset( $bp_deactivated['bp-groups.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-groups.php') ) 58 53 include( BP_PLUGIN_DIR . '/bp-groups.php' ); 59 54 60 55 /* Private Messaging */ 61 56 if ( !isset( $bp_deactivated['bp-messages.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-messages.php') ) 62 57 include( BP_PLUGIN_DIR . '/bp-messages.php' ); 63 58 64 59 /* Extended Profiles */ 65 60 if ( !isset( $bp_deactivated['bp-xprofile.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-xprofile.php') ) 66 61 include( BP_PLUGIN_DIR . '/bp-xprofile.php' ); 67 62 63 // If this is an upgrade, load the upgrade file 64 if ( $bp_db_version < constant( 'BP_DB_VERSION' ) ) { 65 define( 'BP_IS_UPGRADE', true ); 66 require_once( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-upgrade.php' ); 67 } 68 68 69 add_action( 'plugins_loaded', 'bp_loaded', 20 ); 69 70 } 70 71 -
bp-core.php
314 314 if ( !is_super_admin() ) 315 315 return false; 316 316 317 // Don't add this version of the admin menu if a BP upgrade is in progress 318 // See bp_core_upgrade_add_admin_menu() 319 if ( defined( 'BP_IS_UPGRADE' ) && BP_IS_UPGRADE ) 320 return false; 321 317 322 /* Add the administration tab under the "Site Admin" tab for site administrators */ 318 323 $hook = bp_core_add_admin_menu_page( array( 319 324 'menu_title' => __( 'BuddyPress', 'buddypress' ),