<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[BuddyPress] [1759] trunk: Fixed subnav access issues.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1759</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-02 17:32:54 +0000 (Wed, 02 Sep 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixed subnav access issues.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpforumsbbconfigphp">trunk/bp-forums/bb-config.php</a></li>
<li><a href="#trunkbpforumsbpforumsfiltersphp">trunk/bp-forums/bp-forums-filters.php</a></li>
<li><a href="#trunkbpthemesdeprecatedbpmemberuserbarphp">trunk/bp-themes/deprecated/bpmember/userbar.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-core/bp-core-templatetags.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -118,20 +118,18 @@
</span><span class="cx">         
</span><span class="cx">                 /* Loop through each navigation item */
</span><span class="cx">                 foreach ( $bp->bp_options_nav[$bp->current_component] as $subnav_item ) {
</span><del>-                        $title = $subnav_item['name'];
-                        $slug = $subnav_item['slug'];
-                        $link = $subnav_item['link'];
-                        $css_id = $subnav_item['css_id'];
</del><ins>+                        if ( !$subnav_item['user_has_access'] )
+                                continue;
</ins><span class="cx">                         
</span><span class="cx">                         /* If the current action or an action variable matches the nav item id, then add a highlight CSS class. */
</span><del>-                        if ( $slug == $bp->current_action ) {
</del><ins>+                        if ( $subnav_item['slug'] == $bp->current_action ) {
</ins><span class="cx">                                 $selected = ' class="current"';
</span><span class="cx">                         } else {
</span><span class="cx">                                 $selected = '';
</span><span class="cx">                         }
</span><span class="cx">                         
</span><span class="cx">                         /* echo out the final list item */
</span><del>-                        echo '<li' . $selected . '><a id="' . $css_id . '" href="' . $link . '">' . $title . '</a></li>';                
</del><ins>+                        echo '<li' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>';                
</ins><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 /* If we get here we are viewing another user, so show the displayed user's nav items */
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-core.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -276,7 +276,14 @@
</span><span class="cx">                 return false;
</span><span class="cx">                 
</span><span class="cx">         /* Add the administration tab under the "Site Admin" tab for site administrators */
</span><del>-        bp_core_add_admin_menu_page( array( 'menu_title' => __( 'BuddyPress', 'buddypress' ), 'page_title' => __( 'BuddyPress', 'buddypress' ), 'access_level' => 10, 'file' => 'bp-core.php', 'function' => 'bp_core_admin_settings', 'position' => 2 ) );
</del><ins>+        bp_core_add_admin_menu_page( array(
+                'menu_title' => __( 'BuddyPress', 'buddypress' ),
+                'page_title' => __( 'BuddyPress', 'buddypress' ),
+                'access_level' => 10, 'file' => 'bp-core.php',
+                'function' => 'bp_core_admin_settings',
+                'position' => 2
+        ) );
+        
</ins><span class="cx">         add_submenu_page( 'bp-core.php', __( 'General Settings', 'buddypress'), __( 'General Settings', 'buddypress' ), 1, 'bp-core.php', 'bp_core_admin_settings' );
</span><span class="cx">         add_submenu_page( 'bp-core.php', __( 'Component Setup', 'buddypress'), __( 'Component Setup', 'buddypress' ), 2, __FILE__, 'bp_core_admin_component_setup' );
</span><span class="cx"> }
</span><span class="lines">@@ -321,7 +328,14 @@
</span><span class="cx">                 $profile_link = $bp->loggedin_user->domain . '/profile/';
</span><span class="cx">
</span><span class="cx">                 /* Add the subnav items to the profile */
</span><del>-                bp_core_new_subnav_item( array( 'name' => __( 'Public', 'buddypress' ), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => 'profile', 'screen_function' => 'xprofile_screen_display_profile', 'position' => 10 ) );
</del><ins>+                bp_core_new_subnav_item( array(
+                        'name' => __( 'Public', 'buddypress' ),
+                        'slug' => 'public',
+                        'parent_url' => $profile_link,
+                        'parent_slug' => 'profile',
+                        'screen_function' => 'xprofile_screen_display_profile',
+                        'position' => 10
+                ) );
</ins><span class="cx">
</span><span class="cx">                 if ( 'profile' == $bp->current_component ) {
</span><span class="cx">                         if ( bp_is_home() ) {
</span><span class="lines">@@ -571,10 +585,6 @@
</span><span class="cx">         if ( empty($name) || empty($slug) || empty($parent_slug) || empty($parent_url) || empty($screen_function) )
</span><span class="cx">                 return false;
</span><span class="cx">         
</span><del>-        /* If the logged in user does not have access */
-        if ( !$user_has_access )
-                return false;
-        
</del><span class="cx">         /* If this is for site admins only and the user is not one, don't create the subnav item */
</span><span class="cx">         if ( $site_admin_only && !is_site_admin() )
</span><span class="cx">                 return false;
</span><span class="lines">@@ -587,10 +597,11 @@
</span><span class="cx">                 'link' => $parent_url . $slug . '/',
</span><span class="cx">                 'slug' => $slug,
</span><span class="cx">                 'css_id' => $item_css_id,
</span><del>-                'position' => $position
</del><ins>+                'position' => $position,
+                'user_has_access' => $user_has_access
</ins><span class="cx">         );
</span><span class="cx">                 
</span><del>-        if ( $bp->current_action == $slug && $bp->current_component == $parent_slug ) {
</del><ins>+        if ( ( $bp->current_action == $slug && $bp->current_component == $parent_slug ) && $user_has_access ) {
</ins><span class="cx">                 if ( !is_object($screen_function[0]) )
</span><span class="cx">                         add_action( 'wp', $screen_function, 3 );
</span><span class="cx">                 else
</span></span></pre></div>
<a id="trunkbpforumsbbconfigphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bb-config.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bb-config.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-forums/bb-config.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx"> /***
</span><ins>+ * *** IMPORTANT ****
</ins><span class="cx"> * This file will stop people from accessing your bbPress installation directly.
</span><span class="cx"> * It is very important from a security standpoint that this file is not moved.
</span><span class="cx"> * Your actual bb-config.php file will be installed in the root of your WordPress
</span></span></pre></div>
<a id="trunkbpforumsbpforumsfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-filters.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-filters.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-forums/bp-forums-filters.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -1,6 +1,9 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><span class="cx"> /* Apply WordPress defined filters */
</span><ins>+add_filter( 'bp_forums_bbconfig_location', 'wp_filter_kses', 1 );
+add_filter( 'bp_forums_bbconfig_location', 'attribute_escape', 1 );
+
</ins><span class="cx"> add_filter( 'bp_get_the_topic_title', 'wptexturize' );
</span><span class="cx"> add_filter( 'bp_get_the_topic_poster_name', 'wptexturize' );
</span><span class="cx"> add_filter( 'bp_get_the_topic_last_poster_name', 'wptexturize' );
</span></span></pre></div>
<a id="trunkbpthemesdeprecatedbpmemberuserbarphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/deprecated/bpmember/userbar.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/deprecated/bpmember/userbar.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-themes/deprecated/bpmember/userbar.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">                 
</span><span class="cx">                 <p id="login-text"><?php _e( 'You must log in to access your account.', 'buddypress' ) ?></p>
</span><span class="cx">         
</span><del>-                <form name="loginform" id="loginform" action="<?php echo site_url('wp-login.php') ?>" method="post">
</del><ins>+                <form name="loginform" id="loginform" action="<?php echo site_url( 'wp-login.php', 'login' ) ?>" method="post">
</ins><span class="cx">                         <p>
</span><span class="cx">                                 <label><?php _e( 'Username', 'buddypress' ) ?><br />
</span><span class="cx">                                 <input type="text" name="log" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" /></label>
</span></span></pre>
</div>
</div>
</body>
</html>