<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][5316] trunk: Move simple global variable assignments from BP_Core into BuddyPress class as default assignments.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/5316">5316</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2011-11-09 05:43:09 +0000 (Wed, 09 Nov 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move simple global variable assignments from BP_Core into BuddyPress class as default assignments. Move core component includes into BuddyPress::includes().</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcorecatchuriphp">trunk/bp-core/bp-core-catchuri.php</a></li>
<li><a href="#trunkbpcorebpcoreloaderphp">trunk/bp-core/bp-core-loader.php</a></li>
<li><a href="#trunkbploaderphp">trunk/bp-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcorecatchuriphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-catchuri.php (5315 => 5316)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-catchuri.php        2011-11-08 22:31:04 UTC (rev 5315)
+++ trunk/bp-core/bp-core-catchuri.php        2011-11-09 05:43:09 UTC (rev 5316)
</span><span class="lines">@@ -29,13 +29,8 @@
</span><span class="cx">  *
</span><span class="cx">  */
</span><span class="cx"> function bp_core_set_uri_globals() {
</span><del>-        global $bp, $bp_unfiltered_uri, $bp_unfiltered_uri_offset;
-        global $current_blog, $wpdb;
</del><ins>+        global $bp, $current_blog, $wpdb;
</ins><span class="cx"> 
</span><del>-        // Create global component, action, and item variables
-        $bp-&gt;current_component = $bp-&gt;current_item     = '';
-        $bp-&gt;current_action    = $bp-&gt;action_variables = '';
-
</del><span class="cx">         // Don't catch URIs on non-root blogs unless multiblog mode is on
</span><span class="cx">         if ( !bp_is_root_blog() &amp;&amp; !bp_is_multiblog_mode() )
</span><span class="cx">                 return false;
</span><span class="lines">@@ -120,7 +115,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Keep the unfiltered URI safe
</span><del>-        $bp_unfiltered_uri = $bp_uri;
</del><ins>+        $bp-&gt;unfiltered_uri = $bp_uri;
</ins><span class="cx"> 
</span><span class="cx">         // Get slugs of pages into array
</span><span class="cx">         foreach ( (array) $bp-&gt;pages as $page_key =&gt; $bp_page )
</span><span class="lines">@@ -222,7 +217,7 @@
</span><span class="cx"> 
</span><span class="cx">         // Global the unfiltered offset to use in bp_core_load_template().
</span><span class="cx">         // To avoid PHP warnings in bp_core_load_template(), it must always be &gt;= 0
</span><del>-        $bp_unfiltered_uri_offset = $uri_offset &gt;= 0 ? $uri_offset : 0;
</del><ins>+        $bp-&gt;unfiltered_uri_offset = $uri_offset &gt;= 0 ? $uri_offset : 0;
</ins><span class="cx"> 
</span><span class="cx">         // We have an exact match
</span><span class="cx">         if ( isset( $match-&gt;key ) ) {
</span><span class="lines">@@ -314,16 +309,16 @@
</span><span class="cx">  * @return false|int The user ID of the matched user, or false.
</span><span class="cx">  */
</span><span class="cx"> function bp_core_load_template( $templates ) {
</span><del>-        global $post, $bp, $wpdb, $wp_query, $bp_unfiltered_uri, $bp_unfiltered_uri_offset;
</del><ins>+        global $post, $bp, $wpdb, $wp_query;
</ins><span class="cx"> 
</span><span class="cx">         // Determine if the root object WP page exists for this request (TODO: is there an API function for this?
</span><del>-        if ( !empty( $bp_unfiltered_uri_offset ) &amp;&amp; !$page_exists = $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT ID FROM {$wpdb-&gt;posts} WHERE post_name = %s&quot;, $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) ) )
</del><ins>+        if ( !empty( $bp-&gt;unfiltered_uri_offset ) &amp;&amp; !$page_exists = $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT ID FROM {$wpdb-&gt;posts} WHERE post_name = %s&quot;, $bp-&gt;unfiltered_uri[$bp-&gt;unfiltered_uri_offset] ) ) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         // Set the root object as the current wp_query-ied item
</span><span class="cx">         $object_id = 0;
</span><span class="cx">         foreach ( (array)$bp-&gt;pages as $page ) {
</span><del>-                if ( isset( $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) &amp;&amp; $page-&gt;name == $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) {
</del><ins>+                if ( isset( $bp-&gt;unfiltered_uri[$bp-&gt;unfiltered_uri_offset] ) &amp;&amp; ( $page-&gt;name == $bp-&gt;unfiltered_uri[$bp-&gt;unfiltered_uri_offset] ) ) {
</ins><span class="cx">                         $object_id = $page-&gt;id;
</span><span class="cx">                 }
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkbpcorebpcoreloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-loader.php (5315 => 5316)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-loader.php        2011-11-08 22:31:04 UTC (rev 5315)
+++ trunk/bp-core/bp-core-loader.php        2011-11-09 05:43:09 UTC (rev 5316)
</span><span class="lines">@@ -1,38 +1,26 @@
</span><span class="cx"> &lt;?php
</span><ins>+
+/**
+ * BuddyPress Core Loader
+ *
+ * Core contains the commonly used functions, classes, and API's
+ *
+ * @package BuddyPress
+ * @subpackage Core
+ */
+
</ins><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><del>-// Require all of the BuddyPress core libraries
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-cache.php'      );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-hooks.php'      );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-cssjs.php'      );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-update.php'     );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-classes.php'    );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-filters.php'    );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-avatars.php'    );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-widgets.php'    );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-template.php'   );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-buddybar.php'   );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php'   );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-component.php'  );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php'  );
-require( BP_PLUGIN_DIR . '/bp-core/bp-core-moderation.php' );
-
-// Load deprecated functions
-require( BP_PLUGIN_DIR . '/bp-core/deprecated/1.5.php' );
-//require( BP_PLUGIN_DIR . '/bp-core/deprecated/1.6.php' );
-
-// Load the WP admin bar.
-if ( !defined( 'BP_DISABLE_ADMIN_BAR' ) )
-        require( BP_PLUGIN_DIR . '/bp-core/bp-core-adminbar.php'  );
-
-// Move active components from sitemeta, if necessary
-// Provides backpat with earlier versions of BP
-if ( is_multisite() &amp;&amp; $active_components = get_site_option( 'bp-active-components' ) )
-        bp_update_option( 'bp-active-components', $active_components );
-
</del><span class="cx"> class BP_Core extends BP_Component {
</span><span class="cx"> 
</span><ins>+        /**
+         * Start the members component creation process
+         *
+         * @since BuddyPress (1.5)
+         *
+         * @uses BP_Core::bootstrap()
+         */
</ins><span class="cx">         function __construct() {
</span><span class="cx">                 parent::start(
</span><span class="cx">                         '_core',
</span><span class="lines">@@ -43,6 +31,16 @@
</span><span class="cx">                 $this-&gt;bootstrap();
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        /**
+         * Populate the global data needed before BuddyPress can continue
+         *
+         * This involves figuring out the currently required, active, deactive,
+         * and optional components.
+         * 
+         * @since BuddyPress (1.5)
+         *
+         * @global BuddyPress $bp 
+         */
</ins><span class="cx">         private function bootstrap() {
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><span class="lines">@@ -57,6 +55,11 @@
</span><span class="cx"> 
</span><span class="cx">                 /** Components ********************************************************/
</span><span class="cx"> 
</span><ins>+                // Move active components from sitemeta, if necessary
+                // Provides backpat with earlier versions of BP
+                if ( is_multisite() &amp;&amp; $active_components = get_site_option( 'bp-active-components' ) )
+                        bp_update_option( 'bp-active-components', $active_components );
+
</ins><span class="cx">                 // Set the included and optional components.
</span><span class="cx">                 $bp-&gt;optional_components = apply_filters( 'bp_optional_components', array( 'activity', 'blogs', 'forums', 'friends', 'groups', 'messages', 'settings', 'xprofile' ) );
</span><span class="cx"> 
</span><span class="lines">@@ -70,6 +73,7 @@
</span><span class="cx"> 
</span><span class="cx">                 // Pre 1.5 Backwards compatibility
</span><span class="cx">                 } elseif ( $deactivated_components = bp_get_option( 'bp-deactivated-components' ) ) {
</span><ins>+
</ins><span class="cx">                         // Trim off namespace and filename
</span><span class="cx">                         foreach ( (array) $deactivated_components as $component =&gt; $value )
</span><span class="cx">                                 $trimmed[] = str_replace( '.php', '', str_replace( 'bp-', '', $component ) );
</span><span class="lines">@@ -88,6 +92,7 @@
</span><span class="cx"> 
</span><span class="cx">                 // Default to all components active
</span><span class="cx">                 } else {
</span><ins>+
</ins><span class="cx">                         // Set globals
</span><span class="cx">                         $bp-&gt;deactivated_components = array();
</span><span class="cx"> 
</span><span class="lines">@@ -115,6 +120,14 @@
</span><span class="cx">                 $bp-&gt;required_components[] = 'core';
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        /**
+         * Sets up a majority of the BuddyPress globals that require a minimal
+         * amount of processing, meaning they cannot be set in the BuddyPress class.
+         *
+         * @since BuddyPress (1.5)
+         *
+         * @global BuddyPress $bp 
+         */
</ins><span class="cx">         function setup_globals() {
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><span class="lines">@@ -136,29 +149,6 @@
</span><span class="cx">                 if ( empty( $bp-&gt;pages ) )
</span><span class="cx">                         $bp-&gt;pages = bp_core_get_directory_pages();
</span><span class="cx"> 
</span><del>-                /** Admin Bar *********************************************************/
-
-                // Set the 'My Account' global to prevent debug notices
-                $bp-&gt;my_account_menu_id = false;
-
-                /** Component and Action **********************************************/
-
-                // Used for overriding the 2nd level navigation menu so it can be used to
-                // display custom navigation for an item (for example a group)
-                $bp-&gt;is_single_item = false;
-
-                // Sets up the array container for the component navigation rendered
-                // by bp_get_nav()
-                $bp-&gt;bp_nav            = array();
-
-                // Sets up the array container for the component options navigation
-                // rendered by bp_get_options_nav()
-                $bp-&gt;bp_options_nav    = array();
-
-                // Contains an array of all the active components. The key is the slug,
-                // value the internal ID of the component.
-                //$bp-&gt;active_components = array();
-
</del><span class="cx">                 /** Basic current user data *******************************************/
</span><span class="cx"> 
</span><span class="cx">                 // Logged in user is the 'current_user'
</span><span class="lines">@@ -193,15 +183,22 @@
</span><span class="cx">                 do_action( 'bp_core_setup_globals' );
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        /**
+         * Setup BuddyBar navigation
+         *
+         * @since BuddyPress (1.5)
+         *
+         * @global BuddyPress $bp
+         */
</ins><span class="cx">         function setup_nav() {
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><del>-                /***
-                 * If the extended profiles component is disabled, we need to revert to using the
-                 * built in WordPress profile information
-                 */
</del><ins>+                 // If xprofile component is disabled, revert to WordPress profile
</ins><span class="cx">                 if ( !bp_is_active( 'xprofile' ) ) {
</span><span class="cx"> 
</span><ins>+                        // Define local variable
+                        $sub_nav = array();
+
</ins><span class="cx">                         // Fallback values if xprofile is disabled
</span><span class="cx">                         $bp-&gt;core-&gt;profile-&gt;slug = 'profile';
</span><span class="cx">                         $bp-&gt;active_components[$bp-&gt;core-&gt;profile-&gt;slug] = $bp-&gt;core-&gt;profile-&gt;slug;
</span><span class="lines">@@ -225,10 +222,19 @@
</span><span class="cx">                                 'parent_slug'     =&gt; $bp-&gt;core-&gt;profile-&gt;slug,
</span><span class="cx">                                 'screen_function' =&gt; 'bp_core_catch_profile_uri'
</span><span class="cx">                         );
</span><ins>+
+                        parent::setup_nav( $main_nav, $sub_nav );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Setup the BuddyPress Core component
+ *
+ * @since BuddyPress (1.6)
+ *
+ * @global BuddyPress $bp 
+ */
</ins><span class="cx"> function bp_setup_core() {
</span><span class="cx">         global $bp;
</span><span class="cx">         $bp-&gt;core = new BP_Core();
</span></span></pre></div>
<a id="trunkbploaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-loader.php (5315 => 5316)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-loader.php        2011-11-08 22:31:04 UTC (rev 5315)
+++ trunk/bp-loader.php        2011-11-09 05:43:09 UTC (rev 5316)
</span><span class="lines">@@ -71,6 +71,11 @@
</span><span class="cx">          */
</span><span class="cx">         public $maintenance_mode = '';
</span><span class="cx"> 
</span><ins>+        /**
+         * @var bool Include deprecated BuddyPress files or not
+         */
+        public $load_deprecated = true;
+
</ins><span class="cx">         /** Paths *****************************************************************/
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -117,6 +122,66 @@
</span><span class="cx">          */
</span><span class="cx">         public $displayed_user = false;
</span><span class="cx"> 
</span><ins>+        /** Navigation ************************************************************/
+        
+        /**
+         * @var array Primary BuddyPress navigation
+         */
+        public $bp_nav = array();
+
+        /**
+         * @var array Secondary BuddyPress navigation to $bp_nav
+         */
+        public $bp_options_nav = array();
+
+        /** Toolbar ***************************************************************/
+
+        /**
+         * @var string The primary toolbar ID
+         */
+        public $my_account_menu_id = '';
+
+        /** URI's *****************************************************************/
+
+        /**
+         * @var array The unfiltered URI broken down into chunks
+         * @see bp_core_set_uri_globals()
+         */
+        public $unfiltered_uri = array();
+
+        /**
+         * @var int The current offset of the URI
+         * @see bp_core_set_uri_globals()
+         */
+        public $unfiltered_uri_offset = 0;
+        
+        /** Components ************************************************************/
+
+        /**
+         * @var string Name of the current BuddyPress component (primary)
+         */
+        public $current_component = '';
+
+        /**
+         * @var string Name of the current BuddyPress item (secondary)
+         */
+        public $current_item = '';
+
+        /**
+         * @var string Name of the current BuddyPress action (tertiary)
+         */
+        public $current_action = '';
+
+        /**
+         * @var array() Additional navigation elements (supplemental)
+         */
+        public $action_variables = array();
+
+        /**
+         * @var bool Displaying custom 2nd level navigation menu (I.E a group)
+         */
+        public $is_single_item = false;
+
</ins><span class="cx">         /** Errors ****************************************************************/
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -329,7 +394,7 @@
</span><span class="cx"> 
</span><span class="cx">                 // Other identifiers
</span><span class="cx">                 $this-&gt;user_id            = apply_filters( 'bp_user_id', 'bp_user' );
</span><del>-                $this-&gt;edit_id            = apply_filters( 'bp_edit_id', 'edit'     );
</del><ins>+                $this-&gt;edit_id            = apply_filters( 'bp_edit_id', 'edit'    );
</ins><span class="cx"> 
</span><span class="cx">                 /** Users *************************************************************/
</span><span class="cx">                 
</span><span class="lines">@@ -385,13 +450,41 @@
</span><span class="cx">                         // Setup the BuddyPress theme directory
</span><span class="cx">                         register_theme_directory( $this-&gt;themes_dir );
</span><span class="cx"> 
</span><del>-                        // Load core
-                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-loader.php' );
</del><ins>+                        // Require all of the BuddyPress core libraries
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-caps.php'       );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-cache.php'      );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-hooks.php'      );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-cssjs.php'      );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-update.php'     );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-classes.php'    );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-filters.php'    );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-avatars.php'    );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-widgets.php'    );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-template.php'   );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-buddybar.php'   );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-catchuri.php'   );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-component.php'  );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-functions.php'  );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-moderation.php' );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-adminbar.php'   );
+                        require( $this-&gt;plugin_dir . '/bp-core/bp-core-loader.php'     );
</ins><span class="cx"> 
</span><ins>+                        // Skip or load deprecated content
+                        if ( false === $this-&gt;load_deprecated ) {
+                                require( $this-&gt;plugin_dir . '/bp-core/deprecated/1.5.php' );
+                                require( $this-&gt;plugin_dir . '/bp-core/deprecated/1.6.php' );
+                        }
+
</ins><span class="cx">                         // Check if an update is required
</span><del>-                        if ( (int) $this-&gt;db_version_raw &lt; (int) $this-&gt;db_version || ( !empty( $this-&gt;is_network_activate ) ) ) {
</del><ins>+                        if ( ( (int) $this-&gt;db_version_raw &lt; (int) $this-&gt;db_version ) || ( !empty( $this-&gt;is_network_activate ) ) ) {
+
+                                // BuddyPress needs an update
</ins><span class="cx">                                 $this-&gt;maintenance_mode = 'update';
</span><del>-                                require( $this-&gt;plugin_dir . '/bp-core/admin/bp-core-update.php' );
</del><ins>+
+                                // Only include core updater if in the admin area
+                                if ( is_admin() ) {
+                                        require( $this-&gt;plugin_dir . '/bp-core/admin/bp-core-update.php' );
+                                }
</ins><span class="cx">                         }
</span><span class="cx">                 }                
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>