<!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][8439] trunk/src/bp-members/bp-members-loader.php: Whitespace, code formatting, and inline doc clean-up in `BP_Members_Component`.</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">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/8439">8439</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2014-05-21 15:21:05 +0000 (Wed, 21 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Whitespace, code formatting, and inline doc clean-up in `BP_Members_Component`.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpmembersbpmembersloaderphp">trunk/src/bp-members/bp-members-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpmembersbpmembersloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/bp-members/bp-members-loader.php (8438 => 8439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/bp-members/bp-members-loader.php       2014-05-21 12:11:51 UTC (rev 8438)
+++ trunk/src/bp-members/bp-members-loader.php  2014-05-21 15:21:05 UTC (rev 8439)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> <?php
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx">  * BuddyPress Member Loader
</span><span class="cx">  *
</span><span class="lines">@@ -35,6 +36,8 @@
</span><span class="cx">   * @param array $includes See {@link BP_Component::includes()}.
</span><span class="cx">   */
</span><span class="cx">  public function includes( $includes = array() ) {
</span><ins>+
+               // Always include these files
</ins><span class="cx">           $includes = array(
</span><span class="cx">                  'actions',
</span><span class="cx">                  'classes',
</span><span class="lines">@@ -47,6 +50,7 @@
</span><span class="cx">                  'notifications',
</span><span class="cx">          );
</span><span class="cx"> 
</span><ins>+               // Include these only if in admin
</ins><span class="cx">           if ( is_admin() ) {
</span><span class="cx">                  $includes[] = 'admin';
</span><span class="cx">          }
</span><span class="lines">@@ -69,23 +73,27 @@
</span><span class="cx">  public function setup_globals( $args = array() ) {
</span><span class="cx">          $bp = buddypress();
</span><span class="cx"> 
</span><del>-               // Define a slug, if necessary
-               if ( !defined( 'BP_MEMBERS_SLUG' ) )
</del><ins>+                /** Component Globals *************************************************/
+
+               // Define a slug, as a fallback for backpat
+               if ( !defined( 'BP_MEMBERS_SLUG' ) ) {
</ins><span class="cx">                   define( 'BP_MEMBERS_SLUG', $this->id );
</span><ins>+               }
</ins><span class="cx"> 
</span><del>-               $members_globals = array(
-                       'slug'          => BP_MEMBERS_SLUG,
-                       'root_slug'     => isset( $bp->pages->members->slug ) ? $bp->pages->members->slug : BP_MEMBERS_SLUG,
-                       'has_directory' => true,
</del><ins>+                // Override any passed args
+               $args = array(
+                       'slug'            => BP_MEMBERS_SLUG,
+                       'root_slug'       => isset( $bp->pages->members->slug ) ? $bp->pages->members->slug : BP_MEMBERS_SLUG,
+                       'has_directory'   => true,
</ins><span class="cx">                   'directory_title' => _x( 'Members', 'component directory title', 'buddypress' ),
</span><del>-                       'global_tables' => array(
</del><ins>+                        'search_string'   => __( 'Search Members...', 'buddypress' ),
+                       'global_tables'   => array(
</ins><span class="cx">                           'table_name_last_activity' => bp_core_get_table_prefix() . 'bp_activity',
</span><span class="cx">                          'table_name_signups'       => bp_core_get_table_prefix() . 'signups',
</span><del>-                       ),
-                       'search_string' => __( 'Search Members...', 'buddypress' ),
</del><ins>+                        )
</ins><span class="cx">           );
</span><span class="cx"> 
</span><del>-               parent::setup_globals( $members_globals );
</del><ins>+                parent::setup_globals( $args );
</ins><span class="cx"> 
</span><span class="cx">          /** Logged in user ****************************************************/
</span><span class="cx"> 
</span><span class="lines">@@ -112,7 +120,8 @@
</span><span class="cx">          // Fetch the full name displayed user
</span><span class="cx">          $bp->displayed_user->fullname = bp_core_get_user_displayname( bp_displayed_user_id() );
</span><span class="cx"> 
</span><del>-               /** Signup ***************************************************/
</del><ins>+                /** Signup ************************************************************/
+
</ins><span class="cx">           $bp->signup = new stdClass;
</span><span class="cx"> 
</span><span class="cx">          /** Profiles Fallback *************************************************/
</span><span class="lines">@@ -125,17 +134,18 @@
</span><span class="cx"> 
</span><span class="cx">          /** Default Profile Component *****************************************/
</span><span class="cx"> 
</span><del>-               if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) {
</del><ins>+                if ( defined( 'BP_DEFAULT_COMPONENT' ) && BP_DEFAULT_COMPONENT ) {
+                       $bp->default_component = BP_DEFAULT_COMPONENT;
+               } else {
</ins><span class="cx">                   if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) {
</span><span class="cx">                          $bp->default_component = bp_get_activity_slug();
</span><span class="cx">                  } else {
</span><span class="cx">                          $bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id;
</span><span class="cx">                  }
</span><del>-
-               } else {
-                       $bp->default_component = BP_DEFAULT_COMPONENT;
</del><span class="cx">           }
</span><span class="cx"> 
</span><ins>+               /** Canonical Component Stack *****************************************/
+
</ins><span class="cx">           if ( bp_displayed_user_id() ) {
</span><span class="cx">                  $bp->canonical_stack['base_url'] = bp_displayed_user_domain();
</span><span class="cx"> 
</span><span class="lines">@@ -151,10 +161,12 @@
</span><span class="cx">                          $bp->canonical_stack['action_variables'] = bp_action_variables();
</span><span class="cx">                  }
</span><span class="cx"> 
</span><del>-                       if ( !bp_current_component() ) {
</del><ins>+                        // Looking at the single member root/home, so assume the default
+                       if ( ! bp_current_component() ) {
</ins><span class="cx">                           $bp->current_component = $bp->default_component;
</span><del>-                       } else if ( bp_is_current_component( $bp->default_component ) && !bp_current_action() ) {
-                               // The canonical URL will not contain the default component
</del><ins>+
+                       // The canonical URL will not contain the default component
+                       } elseif ( bp_is_current_component( $bp->default_component ) && ! bp_current_action() ) {
</ins><span class="cx">                           unset( $bp->canonical_stack['component'] );
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="lines">@@ -171,7 +183,7 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * Set up component navigation.
</del><ins>+         * Set up fall-back component navigation if XProfile is inactive.
</ins><span class="cx">    *
</span><span class="cx">   * @since BuddyPress (1.5.0)
</span><span class="cx">   *
</span><span class="lines">@@ -183,41 +195,44 @@
</span><span class="cx">   *        description.
</span><span class="cx">   */
</span><span class="cx">  public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
</span><del>-               $bp = buddypress();
</del><span class="cx"> 
</span><del>-               // Add 'Profile' to the main navigation
-               if ( !bp_is_active( 'xprofile' ) ) {
</del><ins>+                // Bail if XProfile component is active
+               if ( bp_is_active( 'xprofile' ) ) {
+                       return;
+               }
</ins><span class="cx"> 
</span><del>-                       // Don't set up navigation if there's no user
-                       if ( !is_user_logged_in() && !bp_is_user() ) {
-                               return;
-                       }
</del><ins>+                // Don't set up navigation if there's no member
+               if ( ! is_user_logged_in() && ! bp_is_user() ) {
+                       return;
+               }
</ins><span class="cx"> 
</span><del>-                       $main_nav = array(
-                               'name'                => __( 'Profile', 'buddypress' ),
-                               'slug'                => $bp->profile->slug,
-                               'position'            => 20,
-                               'screen_function'     => 'bp_members_screen_display_profile',
-                               'default_subnav_slug' => 'public',
-                               'item_css_id'         => $bp->profile->id
-                       );
</del><ins>+                $bp = buddypress();
</ins><span class="cx"> 
</span><del>-                       // User links
-                       $user_domain  = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
-                       $profile_link = trailingslashit( $user_domain . $bp->profile->slug );
</del><ins>+                // Setup the main navigation
+               $main_nav = array(
+                       'name'                => __( 'Profile', 'buddypress' ),
+                       'slug'                => $bp->profile->slug,
+                       'position'            => 20,
+                       'screen_function'     => 'bp_members_screen_display_profile',
+                       'default_subnav_slug' => 'public',
+                       'item_css_id'         => $bp->profile->id
+               );
</ins><span class="cx"> 
</span><del>-                       // Add the subnav items to the profile
-                       $sub_nav[] = array(
-                               'name'            => __( 'View', 'buddypress' ),
-                               'slug'            => 'public',
-                               'parent_url'      => $profile_link,
-                               'parent_slug'     => $bp->profile->slug,
-                               'screen_function' => 'bp_members_screen_display_profile',
-                               'position'        => 10
-                       );
</del><ins>+                // User links
+               $user_domain  = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
+               $profile_link = trailingslashit( $user_domain . $bp->profile->slug );
</ins><span class="cx"> 
</span><del>-                       parent::setup_nav( $main_nav, $sub_nav );
-               }
</del><ins>+                // Setup the subnav items for the member profile
+               $sub_nav[] = array(
+                       'name'            => __( 'View', 'buddypress' ),
+                       'slug'            => 'public',
+                       'parent_url'      => $profile_link,
+                       'parent_slug'     => $bp->profile->slug,
+                       'screen_function' => 'bp_members_screen_display_profile',
+                       'position'        => 10
+               );
+
+               parent::setup_nav( $main_nav, $sub_nav );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -228,13 +243,13 @@
</span><span class="cx"> 
</span><span class="cx">          if ( bp_is_my_profile() ) {
</span><span class="cx">                  $bp->bp_options_title = __( 'You', 'buddypress' );
</span><del>-               } elseif( bp_is_user() ) {
</del><ins>+                } elseif ( bp_is_user() ) {
+                       $bp->bp_options_title  = bp_get_displayed_user_fullname();
</ins><span class="cx">                   $bp->bp_options_avatar = bp_core_fetch_avatar( array(
</span><span class="cx">                          'item_id' => bp_displayed_user_id(),
</span><span class="cx">                          'type'    => 'thumb',
</span><del>-                               'alt'     => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_get_displayed_user_fullname() )
</del><ins>+                                'alt'     => sprintf( __( 'Profile picture of %s', 'buddypress' ), $bp->bp_options_title )
</ins><span class="cx">                   ) );
</span><del>-                       $bp->bp_options_title = bp_get_displayed_user_fullname();
</del><span class="cx">           }
</span><span class="cx"> 
</span><span class="cx">          parent::setup_title();
</span></span></pre>
</div>
</div>

</body>
</html>