<!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][9698] trunk: Introduce `bp_core_get_root_option()` and use throughout BP.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/9698">9698</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/9698","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>boonebgorges</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-04-05 18:18:13 +0000 (Sun, 05 Apr 2015)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Introduce `bp_core_get_root_option()` and use throughout BP.

Previously, we referenced the `$bp->site_options` array directly. This causes
problems in cases where these options may be referenced before the array is
initially populated. `bp_core_get_root_option()` will fetch the requested
value from the array if it's been populated, and will populate it if it has not.

Fixes <a href="http://buddypress.trac.wordpress.org/ticket/6045">#6045</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpactivitybpactivitytemplatephp">trunk/src/bp-activity/bp-activity-template.php</a></li>
<li><a href="#trunksrcbpblogsbpblogsfiltersphp">trunk/src/bp-blogs/bp-blogs-filters.php</a></li>
<li><a href="#trunksrcbpcorebpcoreavatarsphp">trunk/src/bp-core/bp-core-avatars.php</a></li>
<li><a href="#trunksrcbpcorebpcoreoptionsphp">trunk/src/bp-core/bp-core-options.php</a></li>
<li><a href="#trunksrcbpcorebpcoretemplatephp">trunk/src/bp-core/bp-core-template.php</a></li>
<li><a href="#trunksrcbpforumsbpforumsloaderphp">trunk/src/bp-forums/bp-forums-loader.php</a></li>
<li><a href="#trunksrcbpgroupsbpgroupsloaderphp">trunk/src/bp-groups/bp-groups-loader.php</a></li>
<li><a href="#trunksrcbpmembersbpmembersscreensphp">trunk/src/bp-members/bp-members-screens.php</a></li>
<li><a href="#trunksrcbpmembersbpmemberstemplatephp">trunk/src/bp-members/bp-members-template.php</a></li>
<li><a href="#trunksrcbpsettingsbpsettingsloaderphp">trunk/src/bp-settings/bp-settings-loader.php</a></li>
<li><a href="#trunksrcbpxprofilebpxprofileloaderphp">trunk/src/bp-xprofile/bp-xprofile-loader.php</a></li>
<li><a href="#trunktestsphpunittestcasescorefunctionsphp">trunk/tests/phpunit/testcases/core/functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpactivitybpactivitytemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-activity/bp-activity-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-activity/bp-activity-template.php    2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-activity/bp-activity-template.php      2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -295,7 +295,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->pag_num  = bp_sanitize_pagination_arg( 'num',          $r['per_page'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Check if blog/forum replies are disabled
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->disable_blogforum_replies = isset( $bp->site_options['bp-disable-blogforum-comments'] ) ? $bp->site_options['bp-disable-blogforum-comments'] : false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->disable_blogforum_replies = (bool) bp_core_get_root_option( 'bp-disabled-blogforum-comments' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Get an array of the logged in user's favorite activities
</span><span class="cx" style="display: block; padding: 0 10px">                $this->my_favs = maybe_unserialize( bp_get_user_meta( bp_loggedin_user_id(), 'bp_favorite_activities', true ) );
</span></span></pre></div>
<a id="trunksrcbpblogsbpblogsfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-blogs/bp-blogs-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-blogs/bp-blogs-filters.php   2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-blogs/bp-blogs-filters.php     2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,11 +86,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * Stop infinite loops with WordPress MU Sitewide Tags.
</span><span class="cx" style="display: block; padding: 0 10px">         * That plugin changed the way its settings were stored at some point. Thus the dual check.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( ! empty( $bp->site_options['sitewide_tags_blog'] ) ) {
-               $st_options = maybe_unserialize( $bp->site_options['sitewide_tags_blog'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sitewide_tags_blog_settings = bp_core_get_root_option( 'sitewide_tags_blog' );
+       if ( ! empty( $sitewide_tags_blog_settings ) ) {
+               $st_options = maybe_unserialize( $sitewide_tags_blog_settings );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $tags_blog_id = isset( $st_options['tags_blog_id'] ) ? $st_options['tags_blog_id'] : 0;
</span><span class="cx" style="display: block; padding: 0 10px">        } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $tags_blog_id = isset( $bp->site_options['tags_blog_id'] ) ? $bp->site_options['tags_blog_id'] : 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $tags_blog_id = bp_core_get_root_option( 'sitewide_tags_blog' );
+               $tags_blog_id = intval( $tags_blog_id );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span></span></pre></div>
<a id="trunksrcbpcorebpcoreavatarsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-avatars.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-avatars.php     2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-core/bp-core-avatars.php       2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,10 +31,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( !isset( $bp->site_options['fileupload_maxk'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $fileupload_maxk = bp_core_get_root_option( 'fileupload_maxk' );
+               if ( '' === $fileupload_maxk ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', 5120000 ); // 5mb
</span><span class="cx" style="display: block; padding: 0 10px">                } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', $bp->site_options['fileupload_maxk'] * 1024 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', $fileupload_maxk * 1024 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcbpcorebpcoreoptionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-options.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-options.php     2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-core/bp-core-options.php       2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -481,6 +481,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">        return apply_filters( 'bp_core_get_root_options', $root_blog_options_meta );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Get a root option.
+ *
+ * "Root options" are those that apply across an entire installation, and are fetched only a single
+ * time during a pageload and stored in `buddypress()->site_options` to prevent future lookups.
+ * See {@see bp_core_get_root_options()}.
+ *
+ * @since BuddyPress (2.3.0)
+ *
+ * @param  string $option Name of the option key.
+ * @return mixed Value, if found.
+ */
+function bp_core_get_root_option( $option ) {
+       $bp = buddypress();
+
+       if ( ! isset( $bp->site_options ) ) {
+               $bp->site_options = bp_core_get_root_options();
+       }
+
+       $value = '';
+       if ( isset( $bp->site_options[ $option ] ) ) {
+               $value = $bp->site_options[ $option ];
+       }
+
+       return $value;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /** Active? *******************************************************************/
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcbpcorebpcoretemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-template.php    2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-core/bp-core-template.php      2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -819,7 +819,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return false;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $status = buddypress()->site_options['registration'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $status = bp_core_get_root_option( 'registration' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( ( 'none' !== $status ) && ( 'user' !== $status ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span></span></pre></div>
<a id="trunksrcbpforumsbpforumsloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-forums/bp-forums-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-forums/bp-forums-loader.php  2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-forums/bp-forums-loader.php    2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -57,8 +57,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        define( 'BP_FORUMS_SLUG', $this->id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // The location of the bbPress stand-alone config file
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( isset( $bp->site_options['bb-config-location'] ) )
-                       $this->bbconfig = $bp->site_options['bb-config-location'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $bbconfig = bp_core_get_root_option( 'bb-config-location' );
+               if ( '' !== $bbconfig )
+                       $this->bbconfig = $bbconfig;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // All globals for messaging component.
</span><span class="cx" style="display: block; padding: 0 10px">                // Note that global_tables is included in this array.
</span></span></pre></div>
<a id="trunksrcbpgroupsbpgroupsloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-groups/bp-groups-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-groups/bp-groups-loader.php  2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-groups/bp-groups-loader.php    2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -298,7 +298,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // If avatar uploads are not disabled, add avatar option
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( ! (int) $bp->site_options['bp-disable-avatar-uploads'] && $bp->avatar->show_avatars ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $disabled_avatar_uploads = (int) bp_core_get_root_option( 'bp-disable-avatar-uploads' );
+               if ( ! $disabled_avatar_uploads && $bp->avatar->show_avatars ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $this->group_creation_steps['group-avatar'] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'name'     => _x( 'Photo', 'Group screen nav', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'position' => 20
</span></span></pre></div>
<a id="trunksrcbpmembersbpmembersscreensphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/bp-members-screens.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/bp-members-screens.php       2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-members/bp-members-screens.php 2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -156,7 +156,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Finally, let's check the blog details, if the user wants a blog and blog creation is enabled
</span><span class="cx" style="display: block; padding: 0 10px">                if ( isset( $_POST['signup_with_blog'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $active_signup = $bp->site_options['registration'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $active_signup = bp_core_get_root_option( 'registration' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( 'blog' == $active_signup || 'all' == $active_signup ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                $blog_details = bp_core_validate_blog_signup( $_POST['signup_blog_url'], $_POST['signup_blog_title'] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -196,7 +196,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $bp->signup->step = 'save-details';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // No errors! Let's register those deets.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $active_signup = !empty( $bp->site_options['registration'] ) ? $bp->site_options['registration'] : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $active_signup = bp_core_get_root_option( 'registration' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( 'none' != $active_signup ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcbpmembersbpmemberstemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/bp-members-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/bp-members-template.php      2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-members/bp-members-template.php        2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2244,11 +2244,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $signup_allowed = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( is_multisite() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( ! isset( $bp->site_options ) ) {
-                               $bp->site_options = bp_core_get_root_options();
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $registration = bp_core_get_root_option( 'registration' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( in_array( $bp->site_options['registration'], array( 'all', 'user' ) ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( in_array( $registration, array( 'all', 'user' ) ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $signup_allowed = true;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcbpsettingsbpsettingsloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-settings/bp-settings-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-settings/bp-settings-loader.php      2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-settings/bp-settings-loader.php        2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -183,7 +183,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Delete Account
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( !bp_current_user_can( 'bp_moderate' ) && empty( $bp->site_options['bp-disable-account-deletion'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( !bp_current_user_can( 'bp_moderate' ) && ! bp_core_get_root_option( 'bp-disable-account-deletion' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $wp_admin_nav[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'parent' => 'my-account-' . $this->id,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'id'     => 'my-account-' . $this->id . '-delete-account',
</span></span></pre></div>
<a id="trunksrcbpxprofilebpxprofileloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-xprofile/bp-xprofile-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-xprofile/bp-xprofile-loader.php      2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/src/bp-xprofile/bp-xprofile-loader.php        2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,11 +95,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // to use in SQL statements.
</span><span class="cx" style="display: block; padding: 0 10px">                // Defined conditionally to accommodate unit tests
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! defined( 'BP_XPROFILE_BASE_GROUP_NAME' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        define( 'BP_XPROFILE_BASE_GROUP_NAME', stripslashes( $bp->site_options['bp-xprofile-base-group-name'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 define( 'BP_XPROFILE_BASE_GROUP_NAME', stripslashes( bp_core_get_root_option( 'avatar_default' ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! defined( 'BP_XPROFILE_FULLNAME_FIELD_NAME' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        define( 'BP_XPROFILE_FULLNAME_FIELD_NAME', stripslashes( $bp->site_options['bp-xprofile-fullname-field-name'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 define( 'BP_XPROFILE_FULLNAME_FIELD_NAME', stripslashes( bp_core_get_root_option( 'bp-xprofile-fullname-field-name' ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span></span></pre></div>
<a id="trunktestsphpunittestcasescorefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/testcases/core/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/testcases/core/functions.php  2015-04-05 14:21:26 UTC (rev 9697)
+++ trunk/tests/phpunit/testcases/core/functions.php    2015-04-05 18:18:13 UTC (rev 9698)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -521,6 +521,32 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @group bp_core_get_root_option
+        */
+       public function test_bp_core_get_root_option_with_unpopulated_cache() {
+               // Back up and unset global cache.
+               $old_options = buddypress()->site_options;
+               unset( buddypress()->site_options );
+
+               $this->assertSame( $old_options['avatar_default'], bp_core_get_root_option( 'avatar_default' ) );
+
+               // Clean up.
+               buddypress()->site_options = $old_options;
+       }
+
+       /**
+        * @group bp_core_get_root_option
+        */
+       public function test_bp_core_get_root_option_with_populated_cache() {
+               // Back up and unset global cache.
+               $old_options = buddypress()->site_options;
+               buddypress()->site_options = bp_core_get_root_options();
+               $expected = buddypress()->site_options['avatar_default'];
+
+               $this->assertSame( $expected, bp_core_get_root_option( 'avatar_default' ) );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @group bp_core_add_root_component
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_add_root_component_not_in_bp_pages() {
</span></span></pre>
</div>
</div>

</body>
</html>