Index: bp-core/admin/bp-core-update.php
===================================================================
--- bp-core/admin/bp-core-update.php	(revision 4290)
+++ bp-core/admin/bp-core-update.php	(working copy)
@@ -14,20 +14,22 @@
 	}
 
 	function __construct() {
-		// Look for current DB version
-		if ( !$this->database_version = get_site_option( 'bp-db-version' ) ) {
-			if ( $this->database_version = get_option( 'bp-db-version' ) ) {
-				$this->is_network_activate = true;
-			} else {
-				if ( !$this->current_step() ) {
-					setcookie( 'bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH );
-					$_COOKIE['bp-wizard-step'] = 0;
-				}
+		global $bp;
+
+		// Get current DB version
+		$this->database_version = !empty( $bp->database_version ) ? $bp->database_version : '';
+
+		if ( !empty( $bp->is_network_activate ) ) {
+			$this->is_network_activate = $bp->is_network_activate;
+		} else {
+			if ( !$this->current_step() ) {
+				setcookie( 'bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH );
+				$_COOKIE['bp-wizard-step'] = 0;
 			}
 		}
 
 		$this->new_version  = constant( 'BP_DB_VERSION' );
-		$this->setup_type   = ( empty( $this->database_version ) && !(int)get_site_option( 'bp-core-db-version' ) ) ? 'install' : 'update';
+		$this->setup_type   = !empty( $bp->maintenance_mode ) ? $bp->maintenance_mode : '';
 		$this->current_step = $this->current_step();
 
 		// Call the save method that will save data and modify $current_step
@@ -74,7 +76,7 @@
 			if ( $this->database_version < $this->new_version )
 				$steps[] = __( 'Database Update', 'buddypress' );
 
-			if ( $this->database_version < 1225 || !bp_core_get_page_meta() )
+			if ( (int) $this->database_version < 1801 || !bp_core_get_page_meta() )
 				$steps[] = __( 'Pages', 'buddypress' );
 
 			$steps[] = __( 'Finish', 'buddypress' );
@@ -262,8 +264,8 @@
 			$blogs_slug = constant( 'BP_BLOGS_SLUG' );
 		else
 			$blogs_slug = 'blogs';
- 
- 		// Call up old bp-pages to see if a page has been previously linked to Blogs 
+
+ 		// Call up old bp-pages to see if a page has been previously linked to Blogs
 		$page_blog_id 		= is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ? get_current_blog_id() : BP_ROOT_BLOG;
 		$existing_pages_data 	= get_blog_option( $page_blog_id, 'bp-pages' );
 		$existing_pages 	= $existing_pages_data[$page_blog_id];
@@ -364,7 +366,10 @@
 		$existing_pages = bp_core_update_get_page_meta();
 
 		// Get active components
-		$active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );
+		if ( !empty( $bp->active_components ) )
+			$active_components = $bp->active_components;
+		else
+			$active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );
 
 		// Check for defined slugs
 		$members_slug    = !empty( $bp->members->slug    ) ? $bp->members->slug    : __( 'members',  'buddypress' );
@@ -736,7 +741,7 @@
 			// Run the schema install to update tables
 			bp_core_install();
 
-			if ( $this->database_version < 1225 )
+			if ( (int) $this->database_version < 1801 )
 				$this->update_1_3();
 
 			return true;
@@ -751,7 +756,7 @@
 		if ( isset( $_POST['submit'] ) ) {
 			check_admin_referer( 'bpwizard_ms_update' );
 
-			if ( !$active_components = get_option( 'bp-active-components' ) )
+			if ( !$active_components = get_site_option( 'bp-active-components' ) )
 				$active_components = array();
 
 			// Transfer important settings from blog options to site options
@@ -773,10 +778,10 @@
 				$page_blog_id 		= is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ? get_current_blog_id() : BP_ROOT_BLOG;
 				$existing_pages_data 	= get_blog_option( $page_blog_id, 'bp-pages' );
 				$existing_pages 	= $existing_pages_data[$page_blog_id];
-				
+
 				$bp_pages       	= $this->setup_pages( (array)$_POST['bp_pages'] );
 				$bp_pages       	= array_merge( (array)$existing_pages, (array)$bp_pages );
-				
+
 				$existing_pages_data[$page_blog_id] = $bp_pages;
 
 				update_site_option( 'bp-pages', $existing_pages_data );
@@ -1000,13 +1005,13 @@
 			check_admin_referer( 'bpwizard_finish' );
 
 			// Update the DB version in the database
-			update_site_option( 'bp-db-version', constant( 'BP_DB_VERSION' ) );
+			update_site_option( 'bp-db-version', $this->new_version );
 			delete_site_option( 'bp-core-db-version' );
 
 			// Delete the setup cookie
 			@setcookie( 'bp-wizard-step', '', time() - 3600, COOKIEPATH );
 
-			// Load BP, so that the redirect is successful			
+			// Load BP, so that the redirect is successful
 			require_once( WP_PLUGIN_DIR . '/buddypress/bp-core/bp-core-loader.php' );
 
 			// Redirect to the BuddyPress dashboard
@@ -1070,7 +1075,7 @@
 		$active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );
 
 	require_once( dirname( __FILE__ ) . '/bp-core-schema.php' );
-	
+
 	// Core DB Tables
 	bp_core_install_notifications();
 
@@ -1211,16 +1216,16 @@
  * @uses add_submenu_page() WP function to add a submenu item
  */
 function bp_core_update_add_admin_menu() {
-	global $bp, $bp_wizard;
+	global $bp_wizard;
 
 	// Only load this version of the menu if this is an upgrade or a new installation
-	if ( empty( $bp->maintenence_mode ) )
+	if ( empty( $bp_wizard->setup_type ) )
 		return false;
 
 	if ( !current_user_can( 'activate_plugins' ) )
 		return false;
 
-	if ( '' == get_site_option( 'bp-db-version' ) && !(int)get_site_option( 'bp-core-db-version' ) && !$bp_wizard->is_network_activate )
+	if ( 'install' == $bp_wizard->setup_type )
 		$status = __( 'Setup', 'buddypress' );
 	else
 		$status = __( 'Update', 'buddypress' );
@@ -1283,13 +1288,13 @@
  */
 function bp_core_update_get_page_meta() {
 	$page_ids = get_site_option( 'bp-pages' );
-	
+
 	$is_enable_multiblog = is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ? true : false;
 
 	$page_blog_id = $is_enable_multiblog ? get_current_blog_id() : BP_ROOT_BLOG;
-	
+
 	$blog_page_ids = !empty( $page_ids[$page_blog_id] ) ? $page_ids[$page_blog_id] : false;
-	
+
 	return apply_filters( 'bp_core_update_get_page_meta', $blog_page_ids );
 }
 
@@ -1301,8 +1306,11 @@
  * @global $pagenow The current admin page
  */
 function bp_core_update_nag() {
-	global $bp, $pagenow;
+	global $bp_wizard, $pagenow;
 
+	if ( empty( $bp_wizard->setup_type ) )
+		return;
+
 	if ( !is_super_admin() )
 		return;
 
@@ -1311,7 +1319,7 @@
 
 	$url = is_multisite() ? network_admin_url( 'admin.php?page=bp-wizard' ) : admin_url( 'admin.php?page=bp-wizard' );
 
-	switch( $bp->maintenence_mode ) {
+	switch( $bp_wizard->setup_type ) {
 		case 'update':
 			$msg = sprintf( __( 'BuddyPress has been updated! Please run the <a href="%s">update wizard</a>.', 'buddypress' ), $url );
 			break;
